summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2014-11-26 19:12:09 -0500
committerSimon Howard2014-11-26 19:16:05 -0500
commit3e70ef4cf909ba4254258e176f92ab6c931993cb (patch)
tree8fba6fef6896d37d0bbce1d784aba4ab6d666333
parent66b295d461789f204d19b7181b1a11804a666728 (diff)
downloadchocolate-doom-3e70ef4cf909ba4254258e176f92ab6c931993cb.tar.gz
chocolate-doom-3e70ef4cf909ba4254258e176f92ab6c931993cb.tar.bz2
chocolate-doom-3e70ef4cf909ba4254258e176f92ab6c931993cb.zip
hexen: Fix incorrect size on M_StringCopy().
The size parameter for the destination buffer used for this string copy was one character too short, the result being that patch lump names using the maximum length (8 characters) were having the last character cropped off. This in turn caused problems with custom WADs that added new textures with names like these: the game would exit on startup with a message like: R_InitTextures: Missing patch in texture SKY3GOLD Amazingly this bug was not noticed because most of the patches in the Hexen IWAD file have short names of 7 characters or less. The only exception I noticed was SKYWALL2 which maps to SKYWALL, another patch, hiding the bug. Thanks to ETTiNGRiNDER for reporting this bug to me and for providing me with a private copy of his in-development PWAD that I could use to find the problem.
-rw-r--r--src/hexen/r_data.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/hexen/r_data.c b/src/hexen/r_data.c
index d9f76bcb..e99ecc21 100644
--- a/src/hexen/r_data.c
+++ b/src/hexen/r_data.c
@@ -314,7 +314,7 @@ void R_InitTextures(void)
patchlookup = Z_Malloc(nummappatches * sizeof(*patchlookup), PU_STATIC, NULL);
for (i = 0; i < nummappatches; i++)
{
- M_StringCopy(name, name_p + i * 8, 8);
+ M_StringCopy(name, name_p + i * 8, sizeof(name));
patchlookup[i] = W_CheckNumForName(name);
}
W_ReleaseLumpName("PNAMES");