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) if (entry->level == level)
break; break;
// TODO: Add out of bounds check if (++entry >= &self->lookup_table[self->lookup_table_length])
if ((++entry)->symbol != symbol) return; // TODO: Notify the user about this
if (entry->symbol != symbol)
return; // TODO: Notify the user about this return; // TODO: Notify the user about this
} }