From da747fc2918b32e77909f1a36592d3e8c5707847 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sun, 19 Feb 2017 08:59:14 -0600 Subject: [PATCH] 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 89f4a05a..4ffacad9 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;