diff options
author | Simon Howard | 2014-03-29 21:25:55 -0400 |
---|---|---|
committer | Simon Howard | 2014-03-29 21:25:55 -0400 |
commit | 2e6e43c4a706e3670f131c7b2d5a5525f9bf0d7b (patch) | |
tree | 5779e2bb137ce8771b1c12f1f3fd234d16d997f6 /src/hexen/p_setup.c | |
parent | 5f9b4368a2adad65dcc960a76c45d12059ca7214 (diff) | |
download | chocolate-doom-2e6e43c4a706e3670f131c7b2d5a5525f9bf0d7b.tar.gz chocolate-doom-2e6e43c4a706e3670f131c7b2d5a5525f9bf0d7b.tar.bz2 chocolate-doom-2e6e43c4a706e3670f131c7b2d5a5525f9bf0d7b.zip |
heretic: Eliminate use of unsafe string functions.
Eliminate use of strcpy, strcat, strncpy, and use the new safe
alternatives.
Diffstat (limited to 'src/hexen/p_setup.c')
-rw-r--r-- | src/hexen/p_setup.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/hexen/p_setup.c b/src/hexen/p_setup.c index bf4c5359..8940dd32 100644 --- a/src/hexen/p_setup.c +++ b/src/hexen/p_setup.c @@ -31,6 +31,7 @@ #include "i_system.h" #include "m_argv.h" #include "m_bbox.h" +#include "m_misc.h" #include "i_swap.h" #include "s_sound.h" #include "p_local.h" @@ -819,9 +820,9 @@ static void InitMapInfo(void) info->doubleSky = false; info->lightning = false; info->fadetable = W_GetNumForName(DEFAULT_FADE_TABLE); - strcpy(info->name, UNKNOWN_MAP_NAME); + M_StringCopy(info->name, UNKNOWN_MAP_NAME, sizeof(info->name)); -// strcpy(info->songLump, DEFAULT_SONG_LUMP); +// M_StringCopy(info->songLump, DEFAULT_SONG_LUMP, sizeof(info->songLump)); SC_Open(MAPINFO_SCRIPT_NAME); while (SC_GetString()) { @@ -839,20 +840,20 @@ static void InitMapInfo(void) info = &MapInfo[map]; // Save song lump name - strcpy(songMulch, info->songLump); + M_StringCopy(songMulch, info->songLump, sizeof(songMulch)); // Copy defaults to current map definition memcpy(info, &MapInfo[0], sizeof(*info)); // Restore song lump name - strcpy(info->songLump, songMulch); + M_StringCopy(info->songLump, songMulch, sizeof(info->songLump)); // The warp translation defaults to the map number info->warpTrans = map; // Map name must follow the number SC_MustGetString(); - strcpy(info->name, sc_String); + M_StringCopy(info->name, sc_String, sizeof(info->name)); // Process optional tokens while (SC_GetString()) @@ -1106,7 +1107,8 @@ void P_PutMapSongLump(int map, char *lumpName) { return; } - strcpy(MapInfo[map].songLump, lumpName); + M_StringCopy(MapInfo[map].songLump, lumpName, + sizeof(MapInfo[map].songLump)); } //========================================================================== @@ -1210,7 +1212,8 @@ void InitMapMusicInfo(void) for (i = 0; i < 99; i++) { - strcpy(MapInfo[i].songLump, DEFAULT_SONG_LUMP); + M_StringCopy(MapInfo[i].songLump, DEFAULT_SONG_LUMP, + sizeof(MapInfo[i].songLump)); } MapCount = 98; } |