summaryrefslogtreecommitdiff
path: root/drivers/fastboot/fb_command.c
diff options
context:
space:
mode:
authorAndrew Goodbody <andrew.goodbody@linaro.org>2025-07-17 09:43:29 +0100
committerTom Rini <trini@konsulko.com>2025-07-22 11:30:14 -0600
commit23d2c182d4be9f993a4e4d8f4fc6293e4d5a9ff8 (patch)
tree56ac634aaf9c6e681f2077f4cbf4a16f99366fc2 /drivers/fastboot/fb_command.c
parentafca60620ad7958fbee2d5518de0383483c82ced (diff)
fastboot: Fix off by 1 error
strlen only reports length of string not including terminating 0 byte but this has to be included in length of receiving buffer on copy so adjust length check to be correct. This issue found by Smatch. Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Diffstat (limited to 'drivers/fastboot/fb_command.c')
-rw-r--r--drivers/fastboot/fb_command.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
index 7697139b622..791088bc094 100644
--- a/drivers/fastboot/fb_command.c
+++ b/drivers/fastboot/fb_command.c
@@ -413,7 +413,7 @@ static void __maybe_unused run_acmd(char *cmd_parameter, char *response)
return;
}
- if (strlen(cmd_parameter) > sizeof(g_a_cmd_buff)) {
+ if (strlen(cmd_parameter) >= sizeof(g_a_cmd_buff)) {
pr_err("too long command\n");
fastboot_fail("too long command", response);
return;