keyboard: Add bounds checking on keycode lookup

vencrypt
Andri Yngvason 2020-01-19 12:43:48 +00:00
parent 20cd7725f6
commit 5731ea4666
1 changed files with 4 additions and 2 deletions

View File

@ -259,8 +259,10 @@ void keyboard_feed(struct keyboard* self, xkb_keysym_t symbol, bool is_pressed)
if (entry->level == level)
break;
// TODO: Add out of bounds check
if ((++entry)->symbol != symbol)
if (++entry >= &self->lookup_table[self->lookup_table_length])
return; // TODO: Notify the user about this
if (entry->symbol != symbol)
return; // TODO: Notify the user about this
}