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.
This commit is contained in:
X.organic 2021-04-06 03:13:38 +02:00 committed by toaster
parent 0146c0a4bd
commit 0b2783925f

View file

@ -188,26 +188,11 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
dbg_line = -1; // start at -1 so the first line is 0.
while (!myfeof(f))
{
char origpos[128];
INT32 size = 0;
char *traverse;
myfgets(s, MAXLINELEN, f);
memcpy(textline, s, MAXLINELEN);
if (s[0] == '\n' || s[0] == '#')
continue;
traverse = s;
while (traverse[0] != '\n')
{
traverse++;
size++;
}
strncpy(origpos, s, size);
origpos[size] = '\0';
if (NULL != (word = strtok(s, " "))) {
strupr(word);
if (word[strlen(word)-1] == '\n')