2
0
mirror of https://github.com/xcat2/xNBA.git synced 2025-08-25 20:50:29 +00:00

[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>
This commit is contained in:
Michael Brown
2013-03-06 14:41:46 +00:00
parent eb5a2ba596
commit b8cbdbbb53

View File

@@ -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;