summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Baltieri <fabiobaltieri@google.com>2020-12-29 11:53:01 +0000
committerCommit Bot <commit-bot@chromium.org>2021-04-15 18:11:25 +0000
commita7afd3d55f5ea33f0cbeaabc4b61e4d05bec8f14 (patch)
tree998e59d544429943842f122ddd7368d2712678ad
parent029eb3696276bae061b28bd7028a4588a576f4e5 (diff)
downloadchrome-ec-a7afd3d55f5ea33f0cbeaabc4b61e4d05bec8f14.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=servo Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I068779820876167a31076c69dfedb24f0f5e7ed6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2827321 Reviewed-by: Brian Nemec <bnemec@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org>
-rw-r--r--util/ectool_keyscan.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/ectool_keyscan.c b/util/ectool_keyscan.c
index 5d1b77c2c6..96edbb60b8 100644
--- a/util/ectool_keyscan.c
+++ b/util/ectool_keyscan.c
@@ -137,7 +137,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'
};
/**