Skip to content

Commit

Permalink
Fix: follow up to crash when examining discoveries with '`' in certai…
Browse files Browse the repository at this point in the history
…n cases.

NetHack 3.7 also had this bug, and it seems it's been present as far
back as version 3.2.0 - the NetHack devteam released the proper fix for
this earlier today (git commit 3a9e53a).
  • Loading branch information
k21971 committed Feb 7, 2024
1 parent 72d226d commit 9d1b386
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/evilhack-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3343,4 +3343,5 @@ The following changes to date are:
- Fix: crash when examining discoveries with '`' in certain cases
- Fix: allow spear traps to be disarmed
- Fix: heap-use-after-free (bones)
- Fix: follow up to crash when examining discoveries with '`' in certain cases

2 changes: 1 addition & 1 deletion src/invent.c
Original file line number Diff line number Diff line change
Expand Up @@ -4102,7 +4102,7 @@ boolean unpaid, showsym;
else if ((pos = index(oth_symbols, let)) != 0)
class_name = oth_names[pos - oth_symbols];
else
class_name = names[0];
class_name = names[ILLOBJ_CLASS];

len = strlen(class_name) + (unpaid ? sizeof "unpaid_" : sizeof "")
+ (oclass ? (strlen(ocsymfmt) + invbuf_sympadding) : 0);
Expand Down
3 changes: 2 additions & 1 deletion win/curses/cursdial.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ curses_character_input_dialog(const char *prompt, const char *choices,
}
break;
} else if ((answer == '\n') || (answer == '\r') || (answer == ' ')) {
if (choices != NULL) {
if ((choices != NULL)
&& ((def != '\0') || !strchr(choices, answer))) {
answer = def;
}
break;
Expand Down

0 comments on commit 9d1b386

Please sign in to comment.