From 6f0b4a4f6d5f129631f7aed997c332afbfe263e0 Mon Sep 17 00:00:00 2001
From: "X.organic" <dilithium.no3@protonmail.com>
Date: Tue, 6 Apr 2021 03:13:38 +0200
Subject: [PATCH] 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.
---
 src/dehacked.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/src/dehacked.c b/src/dehacked.c
index c2ea28d27c..3f066a924a 100644
--- a/src/dehacked.c
+++ b/src/dehacked.c
@@ -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')
-- 
GitLab