Enforce maximum length of 63 for map lumpname
Also, in g_demo.c, use SKIPSTRING (instead of READSTRINGN into a discard buffer)
This commit is contained in:
parent
2c7e7b8aa8
commit
551c5531d5
3 changed files with 9 additions and 11 deletions
|
|
@ -373,6 +373,8 @@ struct cupheader_t
|
|||
extern cupheader_t *kartcupheaders; // Start of cup linked list
|
||||
extern UINT16 numkartcupheaders;
|
||||
|
||||
#define MAXMAPLUMPNAME 64 // includes \0, for cleaner savedata
|
||||
|
||||
/** Map header information.
|
||||
*/
|
||||
struct mapheader_t
|
||||
|
|
@ -467,8 +469,6 @@ struct mapheader_t
|
|||
extern mapheader_t** mapheaderinfo;
|
||||
extern INT32 nummapheaders, mapallocsize;
|
||||
|
||||
#define MAXMAPLUMPNAME 64 // includes \0, for cleaner savedata
|
||||
|
||||
// Gametypes
|
||||
#define NUMGAMETYPEFREESLOTS 128
|
||||
|
||||
|
|
|
|||
14
src/g_demo.c
14
src/g_demo.c
|
|
@ -2079,7 +2079,7 @@ void G_BeginRecording(void)
|
|||
|
||||
// game data
|
||||
M_Memcpy(demobuf.p, "PLAY", 4); demobuf.p += 4;
|
||||
WRITESTRINGN(demobuf.p, mapheaderinfo[gamemap-1]->lumpname, 255);
|
||||
WRITESTRINGN(demobuf.p, mapheaderinfo[gamemap-1]->lumpname, MAXMAPLUMPNAME);
|
||||
M_Memcpy(demobuf.p, mapmd5, 16); demobuf.p += 16;
|
||||
|
||||
WRITEUINT8(demobuf.p, demoflags);
|
||||
|
|
@ -2502,7 +2502,6 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
|
|||
UINT16 s ATTRUNUSED;
|
||||
UINT8 aflags = 0;
|
||||
boolean uselaps = false;
|
||||
char discard[255];
|
||||
|
||||
// load the new file
|
||||
FIL_DefaultExtension(newname, ".lmp");
|
||||
|
|
@ -2523,7 +2522,7 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
|
|||
p += 16; // demo checksum
|
||||
I_Assert(!memcmp(p, "PLAY", 4));
|
||||
p += 4; // PLAY
|
||||
READSTRINGN(p, discard, sizeof(discard)); // gamemap
|
||||
SKIPSTRING(p); // gamemap
|
||||
p += 16; // map md5
|
||||
flags = READUINT8(p); // demoflags
|
||||
p++; // gametype
|
||||
|
|
@ -2581,7 +2580,7 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
|
|||
Z_Free(buffer);
|
||||
return UINT8_MAX;
|
||||
} p += 4; // "PLAY"
|
||||
READSTRINGN(p, discard, sizeof(discard)); // gamemap
|
||||
SKIPSTRING(p); // gamemap
|
||||
p += 16; // mapmd5
|
||||
flags = READUINT8(p);
|
||||
p++; // gametype
|
||||
|
|
@ -3295,7 +3294,7 @@ void G_AddGhost(char *defdemoname)
|
|||
{
|
||||
INT32 i;
|
||||
lumpnum_t l;
|
||||
char name[17],skin[17],color[MAXCOLORNAME+1],discard[255],*n,*pdemoname,md5[16];
|
||||
char name[17],skin[17],color[MAXCOLORNAME+1],*n,*pdemoname,md5[16];
|
||||
demoghost *gh;
|
||||
UINT8 flags;
|
||||
UINT8 *buffer,*p;
|
||||
|
|
@ -3384,7 +3383,7 @@ void G_AddGhost(char *defdemoname)
|
|||
} p += 4; // "PLAY"
|
||||
|
||||
|
||||
READSTRINGN(p, discard, sizeof(discard)); // gamemap
|
||||
SKIPSTRING(p); // gamemap
|
||||
p += 16; // mapmd5 (possibly check for consistency?)
|
||||
|
||||
flags = READUINT8(p);
|
||||
|
|
@ -3583,7 +3582,6 @@ void G_UpdateStaffGhostName(lumpnum_t l)
|
|||
UINT8 *buffer,*p;
|
||||
UINT16 ghostversion;
|
||||
UINT8 flags;
|
||||
char discard[255];
|
||||
|
||||
buffer = p = W_CacheLumpNum(l, PU_CACHE);
|
||||
|
||||
|
|
@ -3617,7 +3615,7 @@ void G_UpdateStaffGhostName(lumpnum_t l)
|
|||
}
|
||||
|
||||
p += 4; // "PLAY"
|
||||
READSTRINGN(p, discard, sizeof(discard)); // gamemap
|
||||
SKIPSTRING(p); // gamemap
|
||||
p += 16; // mapmd5 (possibly check for consistency?)
|
||||
|
||||
flags = READUINT8(p);
|
||||
|
|
|
|||
|
|
@ -4503,7 +4503,7 @@ void G_SaveGameData(void)
|
|||
for (i = 0; i < nummapheaders; i++) // nummapheaders * (MAXMAPLUMPNAME+1+4+4)
|
||||
{
|
||||
// For figuring out which header to assing it to on load
|
||||
WRITESTRING(save.p, mapheaderinfo[i]->lumpname);
|
||||
WRITESTRINGN(save.p, mapheaderinfo[i]->lumpname, MAXMAPLUMPNAME);
|
||||
|
||||
WRITEUINT8(save.p, (mapheaderinfo[i]->mapvisited & MV_MAX));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue