Skip to content

Commit 72d226d

Browse files
committed
Fix: heap-use-after-free (bones).
Found in GnollHack in regards to HTML dumplogs. Fix is also present in NetHack 3.7.
1 parent 087f562 commit 72d226d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

doc/evilhack-changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3342,4 +3342,5 @@ The following changes to date are:
33423342
- Restore auto-suppression of some dangerous attacks
33433343
- Fix: crash when examining discoveries with '`' in certain cases
33443344
- Fix: allow spear traps to be disarmed
3345+
- Fix: heap-use-after-free (bones)
33453346

src/bones.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,9 +788,9 @@ struct obj *corpse;
788788
store_savefileinfo(fd);
789789
bwrite(fd, (genericptr_t) &c, sizeof c);
790790
bwrite(fd, (genericptr_t) bonesid, (unsigned) c); /* DD.nnn */
791-
savefruitchn(fd, WRITE_SAVE | FREE_SAVE);
791+
savefruitchn(fd, WRITE_SAVE);
792792
update_mlstmv(); /* update monsters for eventual restoration */
793-
savelev(fd, ledger_no(&u.uz), WRITE_SAVE | FREE_SAVE);
793+
savelev(fd, ledger_no(&u.uz), WRITE_SAVE);
794794
bclose(fd);
795795
commit_bonesfile(&u.uz);
796796
compress_bonesfile();

0 commit comments

Comments
 (0)