From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] menu.c: use puts() instead of printf() where possible
Date: Mon, 28 Nov 2011 18:10:02 -0500 [thread overview]
Message-ID: <201111281810.03260.vapier@gentoo.org> (raw)
In-Reply-To: <1322508289-24908-1-git-send-email-wd@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: <http://lists.denx.de/pipermail/u-boot/attachments/20111128/f5b1ecac/attachment.pgp>
next prev parent reply other threads:[~2011-11-28 23:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-28 19:24 [U-Boot] [PATCH] menu.c: use puts() instead of printf() where possible Wolfgang Denk
2011-11-28 23:10 ` Mike Frysinger [this message]
2011-12-01 22:50 ` Wolfgang Denk
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=201111281810.03260.vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=u-boot@lists.denx.de \
/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