diff --git a/ChangeLog.adoc b/ChangeLog.adoc index db74d5bad..e91bd2ab2 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -15,6 +15,13 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] (file _ReleaseNotes.adoc_ in sources). +[[v3.0.1]] +== Version 3.0.1 (under dev) + +Bug fixes:: + + * spell: fix crash with IRC color codes in command line (issue #1589) + [[v3.0]] == Version 3.0 (2020-11-11) diff --git a/src/plugins/spell/spell.c b/src/plugins/spell/spell.c index 62a88388c..4ecd3a433 100644 --- a/src/plugins/spell/spell.c +++ b/src/plugins/spell/spell.c @@ -649,7 +649,7 @@ spell_skip_color_codes (char **string, char **result) { int color_code_size; - while (*string[0]) + while ((*string)[0]) { color_code_size = weechat_string_color_code_size (*string); if (color_code_size > 0) @@ -658,9 +658,9 @@ spell_skip_color_codes (char **string, char **result) weechat_string_dyn_concat (result, *string, color_code_size); (*string) += color_code_size; } - else if (*string[0] == '\x02' || *string[0] == '\x0F' - || *string[0] == '\x11' || *string[0] == '\x16' - || *string[0] == '\x1D' || *string[0] == '\x1F') + else if ((*string)[0] == '\x02' || (*string)[0] == '\x0F' + || (*string)[0] == '\x11' || (*string)[0] == '\x16' + || (*string)[0] == '\x1D' || (*string)[0] == '\x1F') { /* * IRC attribute: @@ -674,28 +674,29 @@ spell_skip_color_codes (char **string, char **result) weechat_string_dyn_concat (result, *string, 1); (*string)++; } - else if (*string[0] == '\x03') + else if ((*string)[0] == '\x03') { /* IRC color code */ weechat_string_dyn_concat (result, *string, 1); (*string)++; - if (isdigit (*string[0])) + if (isdigit ((unsigned char)((*string)[0]))) { /* foreground */ weechat_string_dyn_concat (result, *string, 1); (*string)++; - if (isdigit (*string[0])) + if (isdigit ((unsigned char)((*string)[0]))) { weechat_string_dyn_concat (result, *string, 1); (*string)++; } } - if ((*string[0] == ',') && (isdigit (*string[1]))) + if (((*string)[0] == ',') + && (isdigit ((unsigned char)((*string)[1])))) { /* background */ weechat_string_dyn_concat (result, *string, 1); (*string)++; - if (isdigit (*string[0])) + if (isdigit ((unsigned char)((*string)[0]))) { weechat_string_dyn_concat (result, *string, 1); (*string)++;