From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Frysinger Date: Mon, 28 Nov 2011 18:10:02 -0500 Subject: [U-Boot] [PATCH] menu.c: use puts() instead of printf() where possible In-Reply-To: <1322508289-24908-1-git-send-email-wd@denx.de> References: <1322508289-24908-1-git-send-email-wd@denx.de> Message-ID: <201111281810.03260.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 Monday 28 November 2011 14:24:49 Wolfgang Denk wrote: > common/menu.c used printf() in a number of places to print user > provided, constant strings (like the "title" string). printf() is > dangerous here for example in case the user unwittingly embeds some > '%' caracters that printf() would interpret as formatting and then > pick up random arguments. Use puts() instead. i'm not seeing this problem based on your patch below ... > --- a/common/menu.c > +++ b/common/menu.c > > - if (!m->item_data_print) > - printf("%s\n", item->key); > + putc(item->key); > + putc('\n'); item->key is not passed as the first arg, so % sequences would not get interpreted > - printf("%s:\n", m->title); > + puts(m->title); > + putc('\n'); same here > - printf("^C\n"); > + puts("^C\n"); this change makes sense, but not for any of the reasons cited in the changelog; this looks like a simple optimization ... -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: