summaryrefslogtreecommitdiffstats
path: root/src/hci
diff options
context:
space:
mode:
authorMichael Brown2013-03-06 15:41:46 +0100
committerMichael Brown2013-03-06 15:41:46 +0100
commitb8cbdbbb53512ff35515b3da78b8451b6b8906ae (patch)
treeaa582cdaacc7a1a02db5a6653d8a3feef94b6233 /src/hci
parent[zbin] Fix size used for memset in alloc_output_file (diff)
downloadipxe-b8cbdbbb53512ff35515b3da78b8451b6b8906ae.tar.gz
ipxe-b8cbdbbb53512ff35515b3da78b8451b6b8906ae.tar.xz
ipxe-b8cbdbbb53512ff35515b3da78b8451b6b8906ae.zip
[menu] Prevent character code zero from acting as a shortcut key
Unrecognised keys may be returned by getkey() as character code zero, which currently matches against the first menu item with no shortcut key defined. Prevent this unintended behaviour by explicitly checking that the menu item has a defined shortcut key. Reported-by: Ján ONDREJ (SAL) <ondrejj@salstar.sk> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/hci')
-rw-r--r--src/hci/tui/menu_ui.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/hci/tui/menu_ui.c b/src/hci/tui/menu_ui.c
index dfa1d2e7..49740795 100644
--- a/src/hci/tui/menu_ui.c
+++ b/src/hci/tui/menu_ui.c
@@ -247,7 +247,8 @@ static int menu_loop ( struct menu_ui *ui, struct menu_item **selected ) {
i = 0;
list_for_each_entry ( item, &ui->menu->items,
list ) {
- if ( item->shortcut == key ) {
+ if ( item->shortcut &&
+ ( item->shortcut == key ) ) {
ui->selected = i;
chosen = 1;
break;