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.
We also omit the trailing ':' in the title line - if a user wants
this, he can provide it as part of the title string.
Signed-off-by: Wolfgang Denk <wd@denx.de>
struct menu_item *item,
void *extra)
{
- if (!m->item_data_print)
- printf("%s\n", item->key);
- else
+ if (!m->item_data_print) {
+ putc(item->key);
+ putc('\n');
+ } else {
m->item_data_print(item->data);
+ }
return NULL;
}
*/
static inline void menu_display(struct menu *m)
{
- if (m->title)
- printf("%s:\n", m->title);
+ if (m->title) {
+ puts(m->title);
+ putc('\n');
+ }
menu_items_iter(m, menu_item_print, NULL);
}
if (!choice_item)
printf("%s not found\n", cbuf);
} else {
- printf("^C\n");
+ puts("^C\n");
return -EINTR;
}
}