ソースを参照

[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 11年前
コミット
b8cbdbbb53
1個のファイルの変更2行の追加1行の削除
  1. 2
    1
      src/hci/tui/menu_ui.c

+ 2
- 1
src/hci/tui/menu_ui.c ファイルの表示

@@ -247,7 +247,8 @@ static int menu_loop ( struct menu_ui *ui, struct menu_item **selected ) {
247 247
 				i = 0;
248 248
 				list_for_each_entry ( item, &ui->menu->items,
249 249
 						      list ) {
250
-					if ( item->shortcut == key ) {
250
+					if ( item->shortcut &&
251
+					     ( item->shortcut == key ) ) {
251 252
 						ui->selected = i;
252 253
 						chosen = 1;
253 254
 						break;

読み込み中…
キャンセル
保存