All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@kernel.org>
To: Andrew Goodbody <andrew.goodbody@linaro.org>,
	Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de, Andrew Goodbody <andrew.goodbody@linaro.org>
Subject: Re: [PATCH] fastboot: Fix off by 1 error
Date: Fri, 18 Jul 2025 10:08:02 +0200	[thread overview]
Message-ID: <877c05aplp.fsf@kernel.org> (raw)
In-Reply-To: <20250717-fb_command-v1-1-97695943666b@linaro.org>

Hi Andrew,

Thank you for the patch.

On Thu, Jul 17, 2025 at 09:43, Andrew Goodbody <andrew.goodbody@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@linaro.org>

Good catch!

Reviewed-by: Mattijs Korpershoek <mkorpershoek@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@linaro.org>

  reply	other threads:[~2025-07-18  8:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17  8:43 [PATCH] fastboot: Fix off by 1 error Andrew Goodbody
2025-07-18  8:08 ` Mattijs Korpershoek [this message]
2025-07-22 19:46 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877c05aplp.fsf@kernel.org \
    --to=mkorpershoek@kernel.org \
    --cc=andrew.goodbody@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.