fix github issue #507 - filename buffer overflow

when compressing or uncompressing a save file.  Defining
VAR_PLAYGROUND forces PREFIXES_IN_USE to be defined, and the latter
causes docompress_file() to be called with save file name containing
a full path instead of just save/xyzzy.Z relative to the playground.
Depending on the value of VAR_PLAYGROUND, that could be too long for
the buffer used to make a copy of the name with ".Z"/".gz"/".bz2"
appended.

Probably only applies to Unix/linux/OSX configurations.

Fixes #507
This commit is contained in:
PatR
2021-05-08 18:02:00 -07:00
parent dd6ed5026b
commit c866c9022b
2 changed files with 29 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.527 $ $NHDT-Date: 1620413928 2021/05/07 18:58:48 $
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.528 $ $NHDT-Date: 1620522110 2021/05/09 01:01:50 $
General Fixes and Modified Features
-----------------------------------
@@ -504,6 +504,10 @@ when an unseen non-pet picks up or uses an item, hero loses known/dknown/
particular, player won't be asked what to call unseen thrown potion)
wishing for a partly eaten wraith corpse yielded "partly eaten food (1) more
nutritious than untouched food (0)"
if PREFIXES_IN_USE was defined (and VAR_PLAYGROUND forces it to be) when
COMPRESS was also defined (external save and bones file compression
via fork()+exec()), the file name buffer in docompress_file() wasn't
big enough so could overflow and trigger a crash
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository