[PATCH] fastboot: Fix off by 1 error
Mattijs Korpershoek
mkorpershoek at kernel.org
Fri Jul 18 10:08:02 CEST 2025
Hi Andrew,
Thank you for the patch.
On Thu, Jul 17, 2025 at 09:43, Andrew Goodbody <andrew.goodbody at linaro.org> wrote:
> 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.
This issue was*
>
> Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
Good catch!
Reviewed-by: Mattijs Korpershoek <mkorpershoek at kernel.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 at linaro.org>
More information about the U-Boot
mailing list