Skip to content

Commit

Permalink
drop all keys outside maximum
Browse files Browse the repository at this point in the history
This avoids the danger of a bad configuration file triggering an OOB
array access.
  • Loading branch information
r-c-f committed Jan 29, 2022
1 parent d54d902 commit 6f9bbba
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/wl_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ void wlKey(struct wlContext *ctx, int key, int state)
if (!ctx->input.key_press_state[key] && !state) {
return;
}
if (key >= ctx->input.key_count) {
logWarn("Key %d outside configured keymap, dropping", key);
return;
}
ctx->input.key_press_state[key] += state ? 1 : -1;
key = ctx->input.raw_keymap[key];
key += ctx->input.xkb_key_offset;
Expand Down

0 comments on commit 6f9bbba

Please sign in to comment.