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.goodb...@linaro.org>
---
 drivers/fastboot/fb_command.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
index 2cdbac50ac4..df6e2a81cd5 100644
--- a/drivers/fastboot/fb_command.c
+++ b/drivers/fastboot/fb_command.c
@@ -405,7 +405,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;

---
base-commit: 3b4604a40b9fd61b87e9d059fc56f04d36f1a380
change-id: 20250717-fb_command-275ca03b1f03

Best regards,
-- 
Andrew Goodbody <andrew.goodb...@linaro.org>

Reply via email to