[U-Boot] [PATCH 3/4] Make printf and vprintf safe from buffer overruns

Mike Frysinger
2011-09-23T20:31:55Z

On Friday, September 23, 2011 13:38:51 Simon Glass wrote:
> --- a/common/console.c
> +++ b/common/console.c
> @@ -212,7 +212,7 @@ int serial_printf(const char *fmt, ...)
> /* For this to work, printbuffer must be larger than
> * anything we ever want to print.
> */
> - i = vsprintf(printbuffer, fmt, args);
> + i = vscnprintf(printbuffer, CONFIG_SYS_PBSIZE, fmt, args);

i think sizeof(printbuffer) would be better. same goes for all the other
changes here.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110923/a97d9d44/attachment.pgp