Fix off-by-one error in BRIGHT and TERRAIN lump parsing

This commit is contained in:
JugadorXEI 2024-05-31 17:03:51 +02:00 committed by NepDisk
parent 4d5ba6affb
commit 72354be22d
2 changed files with 12 additions and 12 deletions

View file

@ -112,7 +112,7 @@ static boolean K_BRIGHTLumpParser(char *data, size_t size)
tkn = M_GetToken(NULL);
pos = M_GetTokenPos();
if (tkn && pos < size)
if (tkn && pos <= size)
{
brightmapStorage_t *bms = K_GetBrightmapStorageByTextureName(tkn);
@ -127,7 +127,7 @@ static boolean K_BRIGHTLumpParser(char *data, size_t size)
tkn = M_GetToken(NULL);
pos = M_GetTokenPos();
if (tkn && pos < size)
if (tkn && pos <= size)
{
strncpy(bms->brightmapName, tkn, 8);
bms->brightmapHash = quickncasehash(tkn, 8);

View file

@ -1668,7 +1668,7 @@ static boolean K_TERRAINLumpParser(char *data, size_t size)
tkn = M_GetToken(NULL);
pos = M_GetTokenPos();
if (tkn && pos < size)
if (tkn && pos <= size)
{
t_splash_t *s = NULL;
@ -1709,7 +1709,7 @@ static boolean K_TERRAINLumpParser(char *data, size_t size)
tkn = M_GetToken(NULL);
pos = M_GetTokenPos();
if (tkn && pos < size)
if (tkn && pos <= size)
{
t_footstep_t *fs = NULL;
@ -1750,7 +1750,7 @@ static boolean K_TERRAINLumpParser(char *data, size_t size)
tkn = M_GetToken(NULL);
pos = M_GetTokenPos();
if (tkn && pos < size)
if (tkn && pos <= size)
{
t_overlay_t *o = NULL;
@ -1791,7 +1791,7 @@ static boolean K_TERRAINLumpParser(char *data, size_t size)
tkn = M_GetToken(NULL);
pos = M_GetTokenPos();
if (tkn && pos < size)
if (tkn && pos <= size)
{
terrain_t *t = NULL;
@ -1831,8 +1831,8 @@ static boolean K_TERRAINLumpParser(char *data, size_t size)
Z_Free(tkn);
tkn = M_GetToken(NULL);
pos = M_GetTokenPos();
if (tkn && pos < size)
if (tkn && pos <= size)
{
if (stricmp(tkn, "optional") == 0)
{
@ -1843,7 +1843,7 @@ static boolean K_TERRAINLumpParser(char *data, size_t size)
pos = M_GetTokenPos();
}
if (tkn && pos < size)
if (tkn && pos <= size)
{
t_floor_t *f = NULL;
@ -1872,7 +1872,7 @@ static boolean K_TERRAINLumpParser(char *data, size_t size)
tkn = M_GetToken(NULL);
pos = M_GetTokenPos();
if (tkn && pos < size)
if (tkn && pos <= size)
{
terrain_t *t = K_GetTerrainByName(tkn);
@ -1917,7 +1917,7 @@ static boolean K_TERRAINLumpParser(char *data, size_t size)
tkn = M_GetToken(NULL);
pos = M_GetTokenPos();
if (tkn && pos < size)
if (tkn && pos <= size)
{
terrain_t *t = NULL;
@ -1956,7 +1956,7 @@ static boolean K_TERRAINLumpParser(char *data, size_t size)
tkn = M_GetToken(NULL);
pos = M_GetTokenPos();
if (tkn && pos < size)
if (tkn && pos <= size)
{
t_footstep_t *fs = NULL;