summaryrefslogtreecommitdiff
path: root/src/doom/r_data.c
diff options
context:
space:
mode:
authorSimon Howard2014-03-29 21:23:29 -0400
committerSimon Howard2014-03-29 21:23:29 -0400
commit040ca1cfb5a3e1be7d05bcd90eaa4f01fb68437a (patch)
treea18e508d59f858f2d4bfda860a299a8f271a080a /src/doom/r_data.c
parente76b5678bfcac6fc7a42b2f581192ae08831728e (diff)
downloadchocolate-doom-040ca1cfb5a3e1be7d05bcd90eaa4f01fb68437a.tar.gz
chocolate-doom-040ca1cfb5a3e1be7d05bcd90eaa4f01fb68437a.tar.bz2
chocolate-doom-040ca1cfb5a3e1be7d05bcd90eaa4f01fb68437a.zip
doom: Eliminate use of unsafe string functions.
Eliminate use of strcpy, strcat, strncpy, and use the new safe alternatives.
Diffstat (limited to 'src/doom/r_data.c')
-rw-r--r--src/doom/r_data.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/doom/r_data.c b/src/doom/r_data.c
index 13c9eb98..3d59a171 100644
--- a/src/doom/r_data.c
+++ b/src/doom/r_data.c
@@ -36,6 +36,7 @@
#include "w_wad.h"
#include "doomdef.h"
+#include "m_misc.h"
#include "r_local.h"
#include "p_local.h"
@@ -491,19 +492,19 @@ void R_InitTextures (void)
// Load the patch names from pnames.lmp.
- name[8] = 0;
+ name[8] = 0;
names = W_CacheLumpName (DEH_String("PNAMES"), PU_STATIC);
nummappatches = LONG ( *((int *)names) );
- name_p = names+4;
+ name_p = names + 4;
patchlookup = Z_Malloc(nummappatches*sizeof(*patchlookup), PU_STATIC, NULL);
-
- for (i=0 ; i<nummappatches ; i++)
+
+ for (i = 0; i < nummappatches; i++)
{
- strncpy (name,name_p+i*8, 8);
- patchlookup[i] = W_CheckNumForName (name);
+ M_StringCopy(name, name_p + i * 8, sizeof(name));
+ patchlookup[i] = W_CheckNumForName(name);
}
W_ReleaseLumpName(DEH_String("PNAMES"));
-
+
// Load the map texture definitions from textures.lmp.
// The data is contained in one or two lumps,
// TEXTURE1 for shareware, plus TEXTURE2 for commercial.