From ff725242c738aec29ea16dd12d6f1aff821a5db4 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Tue, 29 Dec 2020 11:53:01 +0000 Subject: ectool_keyscan: add missing null terminator to kbd_plain_xlate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Change-Id: Iafb8249515ffa1a5f7e04a272e54a048eef9a57c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2606228 Reviewed-by: Keith Short Reviewed-by: Simon Glass Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3105735 Commit-Queue: Daisuke Nojiri Tested-by: Daisuke Nojiri --- util/ectool_keyscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/ectool_keyscan.c b/util/ectool_keyscan.c index 46ba221f6e..49745aa2c6 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' }; /** -- cgit v1.2.1