From b32ccca3905aec95b5580b3e7c3aa9437abe0a2a Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sun, 1 Dec 2013 09:50:53 +0100 Subject: [PATCH] irc: check that string is not NULL in functions irc_color_{decode,decode_for_user_entry,encode} --- src/plugins/irc/irc-color.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/plugins/irc/irc-color.c b/src/plugins/irc/irc-color.c index c186f03a6..4deaaaa69 100644 --- a/src/plugins/irc/irc-color.c +++ b/src/plugins/irc/irc-color.c @@ -68,6 +68,9 @@ irc_color_decode (const char *string, int keep_colors) const char *remapped_color; int fg, bg, bold, reverse, italic, underline, rc; + if (!string) + return NULL; + /* * create output string with size of length*2 (with min 128 bytes), * this string will be realloc() later with a larger size if needed @@ -272,6 +275,9 @@ irc_color_decode_for_user_entry (const char *string) unsigned char *out, *ptr_string; int out_length, out_pos, length; + if (!string) + return NULL; + out_length = (strlen (string) * 2) + 1; out = malloc (out_length); if (!out) @@ -341,6 +347,9 @@ irc_color_encode (const char *string, int keep_colors) unsigned char *out, *ptr_string; int out_length, out_pos, length; + if (!string) + return NULL; + out_length = (strlen (string) * 2) + 1; out = malloc (out_length); if (!out)