[ioquake3] 20/25: Fix source filename/includepath length in l_precomp.c
Simon McVittie
smcv at debian.org
Sun Mar 12 18:23:27 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian/master
in repository ioquake3.
commit da747fc2918b32e77909f1a36592d3e8c5707847
Author: Zack Middleton <zack at cloemail.com>
Date: Sun Feb 19 08:59:14 2017 -0600
Fix source filename/includepath length in l_precomp.c
source_t filename and includepath are 1024 but MAX_PATH is 64. As far as
I know the paths don't exceed that so this probably doesn't fix anything.
Similar changes were already made to l_script.c so this makes things
consistent. This was found because it was fixed in RTCW's code.
---
code/botlib/l_precomp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/code/botlib/l_precomp.c b/code/botlib/l_precomp.c
index 89f4a05..4ffacad 100644
--- a/code/botlib/l_precomp.c
+++ b/code/botlib/l_precomp.c
@@ -1035,7 +1035,7 @@ int PC_Directive_include(source_t *source)
{
Com_Memset(&file, 0, sizeof(foundfile_t));
script = LoadScriptFile(path);
- if (script) strncpy(script->filename, path, MAX_PATH);
+ if (script) Q_strncpyz(script->filename, path, sizeof(script->filename));
} //end if
#endif //QUAKE
if (!script)
@@ -2960,7 +2960,7 @@ void PC_SetIncludePath(source_t *source, char *path)
{
size_t len;
- Q_strncpyz(source->includepath, path, MAX_PATH-1);
+ Q_strncpyz(source->includepath, path, sizeof(source->includepath)-1);
len = strlen(source->includepath);
//add trailing path seperator
@@ -3001,7 +3001,7 @@ source_t *LoadSourceFile(const char *filename)
source = (source_t *) GetMemory(sizeof(source_t));
Com_Memset(source, 0, sizeof(source_t));
- strncpy(source->filename, filename, MAX_PATH);
+ Q_strncpyz(source->filename, filename, sizeof(source->filename));
source->scriptstack = script;
source->tokens = NULL;
source->defines = NULL;
@@ -3034,7 +3034,7 @@ source_t *LoadSourceMemory(char *ptr, int length, char *name)
source = (source_t *) GetMemory(sizeof(source_t));
Com_Memset(source, 0, sizeof(source_t));
- strncpy(source->filename, name, MAX_PATH);
+ Q_strncpyz(source->filename, name, sizeof(source->filename));
source->scriptstack = script;
source->tokens = NULL;
source->defines = NULL;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/ioquake3.git
More information about the Pkg-games-commits
mailing list