mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Cc: Ahmad Fatoum <ahmad@a3f.at>
Subject: Re: [PATCH v2 1/2] scripts: omap3-usb-loader: fix heap overflow
Date: Wed, 31 May 2023 12:35:37 +0200	[thread overview]
Message-ID: <20230531103537.GG17518@pengutronix.de> (raw)
In-Reply-To: <20230531102609.844477-1-s.hauer@pengutronix.de>

Gna, forget this. Wrong patches sent.

Sascha

On Wed, May 31, 2023 at 12:26:08PM +0200, Sascha Hauer wrote:
> From: Ahmad Fatoum <ahmad@a3f.at>
> 
> Newer GCC versions correctly warn that the buffer allocated by realloc
> is too small. Correct the size.
> 
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> Link: https://lore.barebox.org/20230531062703.670521-3-ahmad@a3f.at
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  scripts/omap3-usb-loader.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/omap3-usb-loader.c b/scripts/omap3-usb-loader.c
> index a8d626c32f..31a03be8e7 100644
> --- a/scripts/omap3-usb-loader.c
> +++ b/scripts/omap3-usb-loader.c
> @@ -784,7 +784,7 @@ int main(int argc, char *argv[])
>  				file.addr = OMAP_BASE_ADDRESS;
>  
>  				/* commit the file object with the processor specified base address */
> -				args->files = realloc(args->files, filecount);
> +				args->files = realloc(args->files, filecount * sizeof(*args->files));
>  				args->numfiles = filecount;
>  				args->files[filecount - 1] = malloc(sizeof (file));
>  				memcpy(args->files[filecount - 1], &file, sizeof (file));
> -- 
> 2.39.2
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



      parent reply	other threads:[~2023-05-31 10:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31 10:26 Sascha Hauer
2023-05-31 10:26 ` [PATCH v2 2/2] ARM: set zero page accessible before copying ATAGs there Sascha Hauer
2023-05-31 10:35 ` Sascha Hauer [this message]

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=20230531103537.GG17518@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=ahmad@a3f.at \
    --cc=barebox@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox