Home | History | Annotate | Download | only in rogue
History log of /src/games/rogue/save.c
RevisionDateAuthorComments
 1.15  07-Apr-2025  hgutch Fix loading save files

Both monster and weapon damage are represented as strings like "1d1", and
internally the game keeps track of them as pointers to static strings
in memory. When saving, the game saves these pointers and when loading
them the pointers end up being identical to before - which now points to
undefined memory.

So when loading a save game, reset the damage strings based on the type
of monster or weapon.

Pointed out and fix suggested by Anthony C Howe <achowe@snert.com>
(committed with a small modification of said patch).
 1.14  02-May-2021  rillig branches: 1.14.6; 1.14.8;
games: remove trailing whitespace in *.c and *.h
 1.13  14-Jan-2008  dholland ANSIfy. Remove unnecessary casts. Clean up for -Wsign-compare. Make more
things file-static. Other minor tidyups, and fix a couple minor bugs found
along the way.
 1.12  14-Jan-2008  dholland Whitespace/KNF nits.
 1.11  27-Dec-2007  dholland Comprehensive (or at least extensive) string handling cleanup for rogue.

This patch dates (mostly) back to 2002; the critical parts of it were
handled back then by security-officer. As far as I know, there's
nothing exploitable fixed herein.

A slightly earlier version of this patch was reviewed by Christian Biere
when I filed it as PR 34750.
 1.10  17-Mar-2006  abs branches: 1.10.10;
Call fclose() appropriately if there is a problem with the save file.
Coverty CID 2063
 1.9  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22269, verified by myself.
 1.8  01-Oct-2002  mrg - use correctly bounded strings when reloading a saved game. in particular,
do not let the save game file "string length" exceed the amount of space
supplied. as noted by <stanojr@iserver.sk> on bugtraq.
- minor KNF.

tested by simonb.
 1.7  18-Sep-1999  jsm branches: 1.7.8; 1.7.10;
Fix -Wsign-compare warnings.
 1.6  13-Sep-1999  jsm Fix buffer overrun in rogue.
 1.5  10-Nov-1998  hubertf constify, per PR 6148
 1.4  12-Oct-1997  lukem WARNSify (not an insignificant task...)
 1.3  22-Apr-1995  cgd clean up import, NetBSD RCS Ids
 1.2  01-Aug-1993  mycroft Add RCS identifiers.
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2  22-Apr-1995  cgd src/games/rogue from Lite
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.7.10.1  01-Oct-2002  lukem Pull up revision 1.8 (requested by mrg in ticket #892):
- use correctly bounded strings when reloading a saved game. in particular,
do not let the save game file "string length" exceed the amount of space
supplied. as noted by <stanojr@iserver.sk> on bugtraq.
- minor KNF.
tested by simonb.
 1.7.8.1  02-Oct-2002  itojun games/rogue/inventory.c 1.8
games/rogue/save.c 1.8
games/rogue/message.c 1.9
games/rogue/rogue.h 1.13

Use correctly bounded strings when reloading a saved game. In particular,
do not let the save game file "string length" exceed the amount of space
supplied. As noted by <stanojr@iserver.sk> on bugtraq. Fixes SA#2002-021.

(mrg)
 1.10.10.2  23-Mar-2008  matt sync with HEAD
 1.10.10.1  09-Jan-2008  matt sync with HEAD
 1.14.8.1  02-Aug-2025  perseant Sync with HEAD
 1.14.6.1  12-Apr-2025  martin Pull up following revision(s) (requested by hgutch in ticket #1090):

games/rogue/rogue.h: revision 1.25
games/rogue/play.c: revision 1.11
games/rogue/monster.c: revision 1.18
games/rogue/save.c: revision 1.15
games/rogue/object.c: revision 1.15

Fix segfault when canceling "Quit" operation

When pressing 'Q' followed by anything other than 'y', make sure not to
end up calling __unreachable().
Pointed out by Anthony C Howe <achowe%snert.com@localhost>

Fix loading save files

Both monster and weapon damage are represented as strings like "1d1", and
internally the game keeps track of them as pointers to static strings
in memory. When saving, the game saves these pointers and when loading
them the pointers end up being identical to before - which now points to
undefined memory.

So when loading a save game, reset the damage strings based on the type
of monster or weapon.

Pointed out and fix suggested by Anthony C Howe <achowe%snert.com@localhost>
(committed with a small modification of said patch).

RSS XML Feed