curses band-aid

heaputil reported an attempt to free a null pointer at line 1314 of
cursdial.c (in menu_display_page()).

curses_break_str() can return Null but its callers aren't prepared
for that.  Make it return an empty string that can be passed to
free() instead.
This commit is contained in:
PatR
2025-04-20 14:19:40 -07:00
parent 079566cad9
commit e21a5c6ac3

View File

@@ -343,7 +343,12 @@ curses_break_str(const char *str, int width, int line_num)
}
if (curline < line_num) {
#if 0
return NULL;
#else
/* callers aren't prepared to handle NULL return */
Strcpy(curstr, "");
#endif
}
retstr = curses_copy_of(curstr);