mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-29 18:11:05 +00:00
8042: Fix error condition
Since the scancode_setX arrays are defined with size [KEYBOARD_ROWS][KEYBOARD_COLS], if rows or columns are equal to either of those values, it would be accessing values outside of the array. BUG=b:64477774 TEST=Build Change-Id: I8a92d142b03281f2f4ad35eaba605b5a46df798d Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://chromium-review.googlesource.com/606452 Commit-Ready: Martin Roth <martinroth@chromium.org> Tested-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
This commit is contained in:
@@ -313,7 +313,7 @@ static enum ec_error_list matrix_callback(int8_t row, int8_t col,
|
||||
ASSERT(scan_code);
|
||||
ASSERT(len);
|
||||
|
||||
if (row > KEYBOARD_ROWS || col > KEYBOARD_COLS)
|
||||
if (row >= KEYBOARD_ROWS || col >= KEYBOARD_COLS)
|
||||
return EC_ERROR_INVAL;
|
||||
|
||||
if (pressed)
|
||||
|
||||
Reference in New Issue
Block a user