diff options
author | Fabio Baltieri <fabiobaltieri@google.com> | 2020-12-29 11:53:01 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-04-20 14:25:35 +0000 |
commit | a61a003ee0cea226db27fcc6ca91a60585bf2579 (patch) | |
tree | 1cc0df89fb628a23394b78804e342cfffaf87b66 | |
parent | c793eca9cfbb31a9616327547066d64c18e15145 (diff) | |
download | chrome-ec-a61a003ee0cea226db27fcc6ca91a60585bf2579.tar.gz |
ectool_keyscan: add missing null terminator to kbd_plain_xlate
strchr relies on the source string to be null terminated. This fixes a
compiler warning when building outside of the chroot:
util/ectool_keyscan.c: In function ‘cmd_keyscan’:
util/ectool_keyscan.c:208:9: error: ‘strchr’ argument missing terminating nul [-Werror=stringop-overflow=]
208 | pos = strchr(kbd_plain_xlate, key);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
BUG=none
TEST=build only, warning is gone
BRANCH=none
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Change-Id: Iafb8249515ffa1a5f7e04a272e54a048eef9a57c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2606228
Reviewed-by: Keith Short <keithshort@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
(cherry picked from commit 06a82155ef062adaccf3c2469c59ca850f5800c7)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2723463
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | util/ectool_keyscan.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/util/ectool_keyscan.c b/util/ectool_keyscan.c index 8b398b145b..6c64c92fc4 100644 --- a/util/ectool_keyscan.c +++ b/util/ectool_keyscan.c @@ -136,7 +136,7 @@ static const unsigned char kbd_plain_xlate[] = { '8', '9', '-', '4', '5', '6', '+', '1', /* 0x40 - 0x4f */ '2', '3', '0', '.', 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x50 - 0x5F */ - '\r', 0xff, 0xff + '\r', 0xff, 0xff, '\0' }; /** |