pidgin: d7042a52: Head irc_mirc2* bugs off at the pass wit...

elb at pidgin.im elb at pidgin.im
Thu Sep 3 16:16:44 EDT 2009


-----------------------------------------------------------------
Revision: d7042a528fffa8f66dfee421177302e3f598653d
Ancestor: 44905c649e37e48f488411d7a7a456604d6a6fa4
Author: elb at pidgin.im
Date: 2009-09-03T20:12:49
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/d7042a528fffa8f66dfee421177302e3f598653d

Modified files:
        libpurple/protocols/irc/parse.c

ChangeLog: 

Head irc_mirc2* bugs off at the pass with a NULL check

-------------- next part --------------
============================================================
--- libpurple/protocols/irc/parse.c	c11997c11f4d9d31784bee342152c6813019b8a1
+++ libpurple/protocols/irc/parse.c	9608c9a118abec0867ba6c0a41838e62832d9fde
@@ -361,8 +361,13 @@ char *irc_mirc2html(const char *string)
 	char fg[3] = "\0\0", bg[3] = "\0\0";
 	int fgnum, bgnum;
 	int font = 0, bold = 0, underline = 0, italic = 0;
-	GString *decoded = g_string_sized_new(strlen(string));
+	GString *decoded;
 
+	if (string == NULL)
+		return NULL;
+
+	decoded = g_string_sized_new(strlen(string));
+
 	cur = string;
 	do {
 		end = strpbrk(cur, "\002\003\007\017\026\037");
@@ -461,9 +466,14 @@ char *irc_mirc2txt (const char *string)
 
 char *irc_mirc2txt (const char *string)
 {
-	char *result = g_strdup (string);
+	char *result;
 	int i, j;
 
+	if (string == NULL)
+		return NULL;
+
+	result = g_strdup (string);
+
 	for (i = 0, j = 0; result[i]; i++) {
 		switch (result[i]) {
 		case '\002':


More information about the Commits mailing list