Skip to content
Snippets Groups Projects
Verified Commit 6f0b4a4f authored by X.organic's avatar X.organic
Browse files

Remove some dead code from DEH_LoadDehackedFile

Also fixes a buffer overflow, but said overflow generally got caught by
the stack smashing protector. Still, it's better for SOC files not to be
able to crash the game that easily.
parent f0f3b33d
No related branches found
No related tags found
1 merge request!1457Fix a series of buffer overflows in SOC (primarily Character section) loading
...@@ -188,26 +188,11 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile) ...@@ -188,26 +188,11 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
dbg_line = -1; // start at -1 so the first line is 0. dbg_line = -1; // start at -1 so the first line is 0.
while (!myfeof(f)) while (!myfeof(f))
{ {
char origpos[128];
INT32 size = 0;
char *traverse;
myfgets(s, MAXLINELEN, f); myfgets(s, MAXLINELEN, f);
memcpy(textline, s, MAXLINELEN); memcpy(textline, s, MAXLINELEN);
if (s[0] == '\n' || s[0] == '#') if (s[0] == '\n' || s[0] == '#')
continue; continue;
traverse = s;
while (traverse[0] != '\n')
{
traverse++;
size++;
}
strncpy(origpos, s, size);
origpos[size] = '\0';
if (NULL != (word = strtok(s, " "))) { if (NULL != (word = strtok(s, " "))) {
strupr(word); strupr(word);
if (word[strlen(word)-1] == '\n') if (word[strlen(word)-1] == '\n')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment