fix hunger status highlighting text match

Crash triggered by fuzzer.

The Null value for not-hungry between "Satiated" and "Hungry" in the
array of possible hunger states caused a crash if C++ regex handling
was being used.  With posixregex, it would pass benignly for tty but
crash for curses.  I didn't check any other interface.
This commit is contained in:
PatR
2024-09-30 12:41:29 -07:00
parent 7b34edc11a
commit 4e2494c859
3 changed files with 12 additions and 0 deletions

View File

@@ -2502,6 +2502,8 @@ query_arrayvalue(
start_menu(tmpwin, MENU_BEHAVE_STANDARD);
for (i = arrmin; i < arrmax; i++) {
if (!arr[i]) /* the array of hunger status values has a gap ...*/
continue; /*... set to Null between Satiated and Hungry */
any = cg.zeroany;
any.a_int = i + adj;
add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,