changeset 23939:9b2c273d764d

Fix printf of a NULL string and also an invalid free. Fixes #6627
author Daniel Atallah <daniel.atallah@gmail.com>
date Wed, 20 Aug 2008 15:21:46 +0000
parents 93a9cef58d05
children 96ea5e7cdaf9
files libpurple/protocols/oscar/oscar.c
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/oscar.c	Wed Aug 20 00:34:16 2008 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Wed Aug 20 15:21:46 2008 +0000
@@ -824,7 +824,7 @@
 				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 @@
 					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 @@
 		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 @@
 			itmsurl = oscar_encoding_to_utf8(account, info->itmsurl_encoding,
 					info->itmsurl, info->itmsurl_len);
 
-		tmp = (message ? g_markup_escape_text(message, -1) : NULL);
-
-		if (message == NULL && itmsurl != NULL)
-			message = "";
+		tmp2 = tmp = (message ? g_markup_escape_text(message, -1) : NULL);
+
+		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);