Fix potential buffer overflow in DEH_LoadDehackedFile

This commit is contained in:
indev authored and Alug committed 2025-08-08 19:36:28 +02:00
1 parent 3b83c16cab
commit 378eb28ad1
1 file changed
+7 -1
+7 -1
View File
@@ -2862,7 +2862,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
dbg_line = -1; // start at -1 so the first line is 0.
while (!myfeof(f))
{
char origpos[128];
char origpos[256];
INT32 size = 0;
char *traverse;
@@ -2878,6 +2878,12 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
size++;
}
if (size > (int)sizeof(origpos))
{
deh_warning("Line is too long");
size = sizeof(origpos)-1;
}
strncpy(origpos, s, size);
origpos[size] = '\0';