diff libpurple/buddyicon.c @ 16529:42362f23d5a8

Prevent sprintf(%s, NULL) when the icon type isn't recognized.
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 27 Apr 2007 20:21:41 +0000
parents c01528418cc2
children 72e51db8cac3 175eadaead53
line wrap: on
line diff
--- 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