diff options
author | Ethan Blanton <elb@pidgin.im> | 2009-09-03 20:12:49 +0000 |
---|---|---|
committer | Ethan Blanton <elb@pidgin.im> | 2009-09-03 20:12:49 +0000 |
commit | d1594adafbafc98f6993a4283be7f1603770f46d (patch) | |
tree | 70a65c810b6111808d38fb0bc2f6b0f3b1598bbe | |
parent | 226980c4fc0f1cb86cbfb54dffe425c38c819a8a (diff) | |
download | pidgin-d1594adafbafc98f6993a4283be7f1603770f46d.tar.gz |
Head irc_mirc2* bugs off at the pass with a NULL check
-rw-r--r-- | libpurple/protocols/irc/parse.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libpurple/protocols/irc/parse.c b/libpurple/protocols/irc/parse.c index 1b3d9dae10..e7d200f0b4 100644 --- a/libpurple/protocols/irc/parse.c +++ b/libpurple/protocols/irc/parse.c @@ -361,7 +361,12 @@ 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 { @@ -461,9 +466,14 @@ char *irc_mirc2html(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': |