From: Mike Frysinger Date: Fri, 23 Sep 2011 16:31:55 -0400 Subject: [U-Boot] [PATCH 3/4] Make printf and vprintf safe from buffer overruns In-Reply-To: <1316799532-20761-4-git-send-email-sjg@chromium.org> References: <1316799532-20761-1-git-send-email-sjg@chromium.org> <1316799532-20761-4-git-send-email-sjg@chromium.org> Message-ID: <201109231631.56071.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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