mirror of
https://github.com/weechat/weechat.git
synced 2026-07-09 19:23:13 +02:00
core: fix buffer overflow in function utf8_next_char and return NULL for empty string
Now the function utf8_next_char with an empty string returns NULL instead of
the next char, which is most of the time after an allocated buffer.
And the function utf8_char_size with an empty string now returns 0 instead of
1.
This indirectly fixes a buffer overflow in function eval_string_range_chars
when the input string is empty (for example when doing `/eval -n ${chars:}`).
This commit is contained in:
+1
-1
@@ -1328,7 +1328,7 @@ gui_key_chunk_seems_valid (const char *chunk)
|
||||
if (!found)
|
||||
chunk = utf8_next_char (chunk);
|
||||
|
||||
if (chunk[0])
|
||||
if (chunk && chunk[0])
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user