mirror of
https://git.proxmox.com/git/grub2
synced 2025-07-22 23:05:31 +00:00
gfxmenu/gui: Check printf() format in the gui_progress_bar and gui_label
The gui_progress_bar and gui_label components can display the timeout value. The format string can be set through a theme file. This patch adds a validation step to the format string. If a user loads a theme file into the GRUB without this patch then a GUI label with the following settings + label { ... id = "__timeout__" text = "%s" } will interpret the current timeout value as string pointer and print the memory at that position on the screen. It is not desired behavior. Signed-off-by: Thomas Frauendorfer | Miray Software <tf@miray.de> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
parent
83603bea6c
commit
42facd5772
@ -193,6 +193,10 @@ label_set_property (void *vself, const char *name, const char *value)
|
||||
else if (grub_strcmp (value, "@KEYMAP_SHORT@") == 0)
|
||||
value = _("enter: boot, `e': options, `c': cmd-line");
|
||||
/* FIXME: Add more templates here if needed. */
|
||||
|
||||
if (grub_printf_fmt_check(value, "%d") != GRUB_ERR_NONE)
|
||||
value = ""; /* Unsupported format. */
|
||||
|
||||
self->template = grub_strdup (value);
|
||||
self->text = grub_xasprintf (value, self->value);
|
||||
}
|
||||
|
@ -348,6 +348,9 @@ progress_bar_set_property (void *vself, const char *name, const char *value)
|
||||
Please use the shortest form available in you language. */
|
||||
value = _("%ds");
|
||||
|
||||
if (grub_printf_fmt_check(value, "%d") != GRUB_ERR_NONE)
|
||||
value = ""; /* Unsupported format. */
|
||||
|
||||
self->template = grub_strdup (value);
|
||||
}
|
||||
else if (grub_strcmp (name, "font") == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user