mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
(tree_do_search): fix possible off-by-one (PVS-Studio:V557)
Signed-off-by: Andrew V. Samoilov <a.samoilov@gmail.com>
This commit is contained in:
parent
05ea41cdb5
commit
ceefccbd5a
@ -654,7 +654,7 @@ tree_do_search (WTree * tree, int key)
|
||||
l = strlen (tree->search_buffer);
|
||||
if ((l != 0) && (key == KEY_BACKSPACE))
|
||||
tree->search_buffer[--l] = '\0';
|
||||
else if (key && l < sizeof (tree->search_buffer))
|
||||
else if (key && l < sizeof (tree->search_buffer) - 1)
|
||||
{
|
||||
tree->search_buffer[l] = key;
|
||||
tree->search_buffer[++l] = '\0';
|
||||
|
Loading…
Reference in New Issue
Block a user