All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Rae <srae@broadcom.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 2/3] fastboot: Correct fastboot_fail and fastboot_okay strings
Date: Fri, 13 Feb 2015 11:19:51 -0800	[thread overview]
Message-ID: <54DE4E57.50705@broadcom.com> (raw)
In-Reply-To: <1423809223-24219-2-git-send-email-dileep.katta@linaro.org>



On 15-02-12 10:33 PM, Dileep Katta wrote:
> If the string is copied without NULL termination using strncpy(),
> then strncat() on the next line, may concatenate the string after
> some stale (or random) data, if the response string was not
> zero-initialized.
>
> Signed-off-by: Dileep Katta <dileep.katta@linaro.org>
> ---
>   common/fb_mmc.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/common/fb_mmc.c b/common/fb_mmc.c
> index 3911989..73055cc 100644
> --- a/common/fb_mmc.c
> +++ b/common/fb_mmc.c
> @@ -23,13 +23,13 @@ static char *response_str;
>
>   void fastboot_fail(const char *s)
>   {
> -	strncpy(response_str, "FAIL", 4);
> +	strncpy(response_str, "FAIL\0", 5);
>   	strncat(response_str, s, RESPONSE_LEN - 4 - 1);
>   }
>
>   void fastboot_okay(const char *s)
>   {
> -	strncpy(response_str, "OKAY", 4);
> +	strncpy(response_str, "OKAY\0", 5);
>   	strncat(response_str, s, RESPONSE_LEN - 4 - 1);
>   }
>
>

THANKS!

Reviewed-by: Steve Rae <srae@broadcom.com>

  reply	other threads:[~2015-02-13 19:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-13  6:33 [U-Boot] [PATCH v1 1/3] fastboot: OUT transaction length must be aligned to wMaxPacketSize Dileep Katta
2015-02-13  6:33 ` [U-Boot] [PATCH v1 2/3] fastboot: Correct fastboot_fail and fastboot_okay strings Dileep Katta
2015-02-13 19:19   ` Steve Rae [this message]
2015-02-24 10:28   ` Lukasz Majewski
2015-02-13  6:33 ` [U-Boot] [PATCH v1 3/3] usb: gadget: fastboot: Set the Serial Number for Fastboot Gadget Dileep Katta
2015-02-13 19:32   ` Steve Rae
2015-02-24 10:28   ` Lukasz Majewski
2015-02-13 17:59 ` [U-Boot] [PATCH v2 1/3] fastboot: OUT transaction length must be aligned to wMaxPacketSize Dileep Katta
2015-02-13 19:53   ` Stegmaier, Angela
2015-02-16 20:32     ` [U-Boot] [PATCH v3 " Dileep Katta
2015-02-24 10:28       ` Lukasz Majewski
2016-03-10 23:46         ` [U-Boot] Anyone else having issues with "fastboot flash" - because of this change? Steve Rae
2016-03-11  0:11           ` Steve Rae
2015-02-13 19:53   ` [U-Boot] [PATCH v2 1/3] fastboot: OUT transaction length must be aligned to wMaxPacketSize Steve Rae

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=54DE4E57.50705@broadcom.com \
    --to=srae@broadcom.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.