mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
SW: Fix a few memory access errors related to demo support
From-SVN: r8797
This commit is contained in:
parent
6d537f6d75
commit
00daf6295e
2 changed files with 9 additions and 2 deletions
|
@ -363,6 +363,9 @@ DemoTerm(void)
|
||||||
|
|
||||||
if (DemoSyncTest||DemoSyncRecord)
|
if (DemoSyncTest||DemoSyncRecord)
|
||||||
{
|
{
|
||||||
|
if (DemoSyncFile == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
fclose(DemoSyncFile);
|
fclose(DemoSyncFile);
|
||||||
DemoSyncFile = NULL;
|
DemoSyncFile = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -606,11 +606,13 @@ void LoadDemoRun(void)
|
||||||
if (fin)
|
if (fin)
|
||||||
{
|
{
|
||||||
memset(DemoName,'\0',sizeof(DemoName));
|
memset(DemoName,'\0',sizeof(DemoName));
|
||||||
for (i = 0; TRUE; i++)
|
for (i = 0; i < ARRAY_SSIZE(DemoName); i++)
|
||||||
{
|
{
|
||||||
if (fscanf(fin, "%s", DemoName[i]) == EOF)
|
if (fscanf(fin, "%s", DemoName[i]) == EOF)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (i == ARRAY_SSIZE(DemoName))
|
||||||
|
initputs("WARNING: demos.run is too long, ignoring remaining files\n");
|
||||||
|
|
||||||
fclose(fin);
|
fclose(fin);
|
||||||
}
|
}
|
||||||
|
@ -621,11 +623,13 @@ void LoadDemoRun(void)
|
||||||
{
|
{
|
||||||
fgets(ds, 6, fin);
|
fgets(ds, 6, fin);
|
||||||
sscanf(ds,"%d",&DemoTextYstart);
|
sscanf(ds,"%d",&DemoTextYstart);
|
||||||
for (i = 0; TRUE; i++)
|
for (i = 0; i < ARRAY_SSIZE(DemoText); i++)
|
||||||
{
|
{
|
||||||
if (fgets(DemoText[i], SIZ(DemoText[0])-1, fin) == NULL)
|
if (fgets(DemoText[i], SIZ(DemoText[0])-1, fin) == NULL)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (i == ARRAY_SSIZE(DemoText))
|
||||||
|
initputs("WARNING: demotxt.run is too long, trimming the text\n");
|
||||||
|
|
||||||
fclose(fin);
|
fclose(fin);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue