# HG changeset patch # User Daniel Atallah # Date 1177705301 0 # Node ID 42362f23d5a84784da3403105c286608bcfd2938 # Parent 1c07ce257fd7f5d598f87ae27a10c6b13d03f632 Prevent sprintf(%s, NULL) when the icon type isn't recognized. diff -r 1c07ce257fd7 -r 42362f23d5a8 libpurple/buddyicon.c --- a/libpurple/buddyicon.c Fri Apr 27 18:56:41 2007 +0000 +++ b/libpurple/buddyicon.c Fri Apr 27 20:21:41 2007 +0000 @@ -98,6 +98,7 @@ { PurpleCipherContext *context; gchar digest[41]; + const char *ext; context = purple_cipher_context_new_by_name("sha1", NULL); if (context == NULL) @@ -115,9 +116,10 @@ } purple_cipher_context_destroy(context); + ext = purple_util_get_image_extension(icon_data, icon_len); + /* Return the filename */ - return g_strdup_printf("%s.%s", digest, - purple_util_get_image_extension(icon_data, icon_len)); + return g_strdup_printf("%s%s%s", digest, ext ? "." : "", ext ? ext : ""); } static void