Re: [PATCH v2 1/2] scripts: omap3-usb-loader: fix heap overflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Gna, forget this. Wrong patches sent.

Sascha

On Wed, May 31, 2023 at 12:26:08PM +0200, Sascha Hauer wrote:
> From: Ahmad Fatoum <ahmad@xxxxxx>
> 
> Newer GCC versions correctly warn that the buffer allocated by realloc
> is too small. Correct the size.
> 
> Signed-off-by: Ahmad Fatoum <ahmad@xxxxxx>
> Link: https://lore.barebox.org/20230531062703.670521-3-ahmad@xxxxxx
> Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
> ---
>  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 |




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux