pidgin: 975aa92f: Fix printf of a NULL string and also an ...

datallah at pidgin.im datallah at pidgin.im
Wed Aug 20 11:25:55 EDT 2008


-----------------------------------------------------------------
Revision: 975aa92fa23adeff2b6212736536261186f70528
Ancestor: 70e8a5f4db432a4eead3f39b031731a40e18314d
Author: datallah at pidgin.im
Date: 2008-08-20T15:21:46
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/975aa92fa23adeff2b6212736536261186f70528

Modified files:
        libpurple/protocols/oscar/oscar.c

ChangeLog: 

Fix printf of a NULL string and also an invalid free. Fixes #6627

-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/oscar.c	a72575ffdee994982fb234524205c76ef44d8a7d
+++ libpurple/protocols/oscar/oscar.c	69d6fd0126ac88eed80d3bf6e8c12aa956f13c66
@@ -824,7 +824,7 @@ static void oscar_user_info_append_statu
 				message = oscar_encoding_to_utf8(account, tmp, userinfo->away,
 												   userinfo->away_len);
 				g_free(tmp);
-				}
+			}
 		} else {
 			/* Available message? */
 			if ((userinfo->status != NULL) && userinfo->status[0] != '\0') {
@@ -881,7 +881,7 @@ static void oscar_user_info_append_statu
 					status_name = NULL;
 
 				tmp = g_strdup_printf("%s%s%s",
-									   status_name,
+									   status_name ? status_name : "",
 									   ((status_name && message) && *message) ? ": " : "",
 									   (message && *message) ? message : "");
 				g_free(message);
@@ -2002,6 +2002,7 @@ static int purple_parse_oncoming(OscarDa
 		char *message = NULL;
 		char *itmsurl = NULL;
 		char *tmp;
+		const char *tmp2;
 
 		if (info->status != NULL && info->status[0] != '\0')
 			/* Grab the available message */
@@ -2013,13 +2014,13 @@ static int purple_parse_oncoming(OscarDa
 			itmsurl = oscar_encoding_to_utf8(account, info->itmsurl_encoding,
 					info->itmsurl, info->itmsurl_len);
 
-		tmp = (message ? g_markup_escape_text(message, -1) : NULL);
+		tmp2 = tmp = (message ? g_markup_escape_text(message, -1) : NULL);
 
-		if (message == NULL && itmsurl != NULL)
-			message = "";
+		if (tmp2 == NULL && itmsurl != NULL)
+			tmp2 = "";
 
 		purple_prpl_got_user_status(account, info->sn, status_id,
-				"message", tmp, "itmsurl", itmsurl, NULL);
+				"message", tmp2, "itmsurl", itmsurl, NULL);
 		g_free(tmp);
 
 		g_free(message);


More information about the Commits mailing list