diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2013-12-01 09:50:53 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2013-12-01 09:50:53 +0100 |
commit | b32ccca3905aec95b5580b3e7c3aa9437abe0a2a (patch) | |
tree | 223dce7ba2544ff6d9fe582745f877027c332895 /src/plugins | |
parent | c8a479453d327ae8b9c1c1e3e0dbdc042e7b9b66 (diff) | |
download | weechat-b32ccca3905aec95b5580b3e7c3aa9437abe0a2a.zip |
irc: check that string is not NULL in functions irc_color_{decode,decode_for_user_entry,encode}
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/irc/irc-color.c | 9 |
1 files changed, 9 insertions, 0 deletions
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) |