changeset 28538:c4a14bbe1b18

Head irc_mirc2* bugs off at the pass with a NULL check
author Ethan Blanton <elb@pidgin.im>
date Thu, 03 Sep 2009 20:12:49 +0000
parents 62edf13f815b
children 3bc638342316
files libpurple/protocols/irc/parse.c
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/irc/parse.c	Thu Sep 03 18:20:53 2009 +0000
+++ b/libpurple/protocols/irc/parse.c	Thu Sep 03 20:12:49 2009 +0000
@@ -361,7 +361,12 @@
 	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 {
@@ -461,9 +466,14 @@
 
 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':