diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-10-18 17:54:33 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-10-18 17:54:33 +0200 |
commit | bbe01eff1916434069ec4af4256789e9591687b5 (patch) | |
tree | 47f494025de9ef07d702081ee0d949c64b750ff6 /src/plugins/aspell | |
parent | 091c07d57184aa0da5b12012fd67951c8524a2e3 (diff) | |
download | weechat-bbe01eff1916434069ec4af4256789e9591687b5.zip |
Fix malloc of 0 byte in aspell plugin
Diffstat (limited to 'src/plugins/aspell')
-rw-r--r-- | src/plugins/aspell/aspell.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/aspell/aspell.c b/src/plugins/aspell/aspell.c index b44f78dea..33628f78c 100644 --- a/src/plugins/aspell/aspell.c +++ b/src/plugins/aspell/aspell.c @@ -755,7 +755,7 @@ weechat_aspell_modifier_cb (void *data, const char *modifier, (void) data; (void) modifier; - if (!string) + if (!string || !string[0]) return NULL; sscanf (modifier_data, "%x", &value); @@ -795,11 +795,12 @@ weechat_aspell_modifier_cb (void *data, const char *modifier, length_color_error = strlen (color_error); length = strlen (string); - result = malloc (length + (length * length_color_error)); - result[0] = '\0'; + result = malloc (length + (length * length_color_error) + 1); if (result) { + result[0] = '\0'; + ptr_string = aspell_last_modifier_string; index_result = 0; @@ -881,7 +882,7 @@ weechat_aspell_modifier_cb (void *data, const char *modifier, result[index_result] = '\0'; } - + if (!result) return NULL; |