diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 7fba2fda7..83fc4c1da 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -2619,6 +2619,8 @@ fix msg_window:combination and TTY getlin() ^P (pr #1155 by entrez) remove a null sobj check from gold_detect that was situated after dereferences had already been done (pr #1173 by argrath) and adjust prototype in extern.h +check for valid indexes of def_monsyms[] and def_oc_syms[] in + choose_classes_menu() (pr #1179 by argrath) Code Cleanup and Reorganization diff --git a/src/windows.c b/src/windows.c index e67cca41d..b3ddc3dfa 100644 --- a/src/windows.c +++ b/src/windows.c @@ -1665,10 +1665,12 @@ choose_classes_menu(const char *prompt, start_menu(win, MENU_BEHAVE_STANDARD); while (*class_list) { int idx; + selected = FALSE; switch (category) { case 0: - if ((idx = def_char_to_monclass(*class_list)) == MAXMCLASSES) { + idx = def_char_to_monclass(*class_list); + if (!IndexOk(idx, def_monsyms)) { panic("choose_classes_menu: invalid monclass '%c'", *class_list); /*NOTREACHED*/ } @@ -1677,7 +1679,8 @@ choose_classes_menu(const char *prompt, Sprintf(buf, "%s", text); break; case 1: - if ((idx = def_char_to_objclass(*class_list)) == MAXOCLASSES) { + idx = def_char_to_objclass(*class_list); + if (!IndexOk(idx, def_oc_syms)) { panic("choose_classes_menu: invalid objclass '%c'", *class_list); /*NOTREACHED*/ }