mirror of
https://github.com/troglobit/editline.git
synced 2025-05-05 20:11:12 +08:00
Defensive programming, check within boundaries before deref
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
e36aae07f8
commit
b44335f413
@ -1999,7 +1999,7 @@ static size_t find_key_in_map(int key, el_keymap_t map[], size_t mapsz)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; map[i].Function && i < mapsz; i++) {
|
||||
for (i = 0; i < mapsz && map[i].Function; i++) {
|
||||
if (map[i].Key == key)
|
||||
return i;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user