Browse Source

[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>
tags/v1.20.1
Michael Brown 12 years ago
parent
commit
b8cbdbbb53
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      src/hci/tui/menu_ui.c

+ 2
- 1
src/hci/tui/menu_ui.c View File

247
 				i = 0;
247
 				i = 0;
248
 				list_for_each_entry ( item, &ui->menu->items,
248
 				list_for_each_entry ( item, &ui->menu->items,
249
 						      list ) {
249
 						      list ) {
250
-					if ( item->shortcut == key ) {
250
+					if ( item->shortcut &&
251
+					     ( item->shortcut == key ) ) {
251
 						ui->selected = i;
252
 						ui->selected = i;
252
 						chosen = 1;
253
 						chosen = 1;
253
 						break;
254
 						break;

Loading…
Cancel
Save