mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-08-06 23:36:59 +02:00
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>
This commit is contained in:
parent
afca60620a
commit
23d2c182d4
@ -413,7 +413,7 @@ static void __maybe_unused run_acmd(char *cmd_parameter, char *response)
|
|||||||
return;
|
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");
|
pr_err("too long command\n");
|
||||||
fastboot_fail("too long command", response);
|
fastboot_fail("too long command", response);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user