All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fastboot: Fix off by 1 error
@ 2025-07-17  8:43 Andrew Goodbody
  2025-07-18  8:08 ` Mattijs Korpershoek
  2025-07-22 19:46 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Andrew Goodbody @ 2025-07-17  8:43 UTC (permalink / raw)
  To: Mattijs Korpershoek, Tom Rini; +Cc: u-boot, Andrew Goodbody

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>
---
 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.goodbody@linaro.org>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-22 19:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-17  8:43 [PATCH] fastboot: Fix off by 1 error Andrew Goodbody
2025-07-18  8:08 ` Mattijs Korpershoek
2025-07-22 19:46 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.