This is an automated email from the git hooks/post-receive script. smcv pushed a commit to tag 1.51 in repository iortcw.
commit b4abba7f0ce565d759ac791eb6f784fd76c1812a Author: MAN-AT-ARMS <m4n4t4...@gmail.com> Date: Thu May 25 10:56:10 2017 -0400 All: Check for truncated paths in Sys_LoadDll --- MP/code/sys/sys_main.c | 28 ++++++++++++++++++++++------ SP/code/sys/sys_main.c | 28 ++++++++++++++++++++++------ 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/MP/code/sys/sys_main.c b/MP/code/sys/sys_main.c index 0843f9e..583e89a 100644 --- a/MP/code/sys/sys_main.c +++ b/MP/code/sys/sys_main.c @@ -513,16 +513,25 @@ void *Sys_LoadDll(const char *name, qboolean useSystemLib) { const char *topDir; char libPath[MAX_OSPATH]; + int len; topDir = Sys_BinaryPath(); if(!*topDir) topDir = "."; - Com_Printf("Trying to load \"%s\" from \"%s\"...\n", name, topDir); - Com_sprintf(libPath, sizeof(libPath), "%s%c%s", topDir, PATH_SEP, name); + len = Com_sprintf(libPath, sizeof(libPath), "%s%c%s", topDir, PATH_SEP, name); + if(len < sizeof(libPath)) + { + Com_Printf("Trying to load \"%s\" from \"%s\"...\n", name, topDir); + dllhandle = Sys_LoadLibrary(libPath); + } + else + { + Com_Printf("Skipping trying to load \"%s\" from \"%s\", file name is too long.\n", name, topDir); + } - if(!(dllhandle = Sys_LoadLibrary(libPath))) + if(!dllhandle) { const char *basePath = Cvar_VariableString("fs_basepath"); @@ -531,9 +540,16 @@ void *Sys_LoadDll(const char *name, qboolean useSystemLib) if(FS_FilenameCompare(topDir, basePath)) { - Com_Printf("Trying to load \"%s\" from \"%s\"...\n", name, basePath); - Com_sprintf(libPath, sizeof(libPath), "%s%c%s", basePath, PATH_SEP, name); - dllhandle = Sys_LoadLibrary(libPath); + len = Com_sprintf(libPath, sizeof(libPath), "%s%c%s", basePath, PATH_SEP, name); + if(len < sizeof(libPath)) + { + Com_Printf("Trying to load \"%s\" from \"%s\"...\n", name, basePath); + dllhandle = Sys_LoadLibrary(libPath); + } + else + { + Com_Printf("Skipping trying to load \"%s\" from \"%s\", file name is too long.\n", name, basePath); + } } if(!dllhandle) diff --git a/SP/code/sys/sys_main.c b/SP/code/sys/sys_main.c index 64d1ab8..3b2f35f 100644 --- a/SP/code/sys/sys_main.c +++ b/SP/code/sys/sys_main.c @@ -513,16 +513,25 @@ void *Sys_LoadDll(const char *name, qboolean useSystemLib) { const char *topDir; char libPath[MAX_OSPATH]; + int len; topDir = Sys_BinaryPath(); if(!*topDir) topDir = "."; - Com_Printf("Trying to load \"%s\" from \"%s\"...\n", name, topDir); - Com_sprintf(libPath, sizeof(libPath), "%s%c%s", topDir, PATH_SEP, name); + len = Com_sprintf(libPath, sizeof(libPath), "%s%c%s", topDir, PATH_SEP, name); + if(len < sizeof(libPath)) + { + Com_Printf("Trying to load \"%s\" from \"%s\"...\n", name, topDir); + dllhandle = Sys_LoadLibrary(libPath); + } + else + { + Com_Printf("Skipping trying to load \"%s\" from \"%s\", file name is too long.\n", name, topDir); + } - if(!(dllhandle = Sys_LoadLibrary(libPath))) + if(!dllhandle) { const char *basePath = Cvar_VariableString("fs_basepath"); @@ -531,9 +540,16 @@ void *Sys_LoadDll(const char *name, qboolean useSystemLib) if(FS_FilenameCompare(topDir, basePath)) { - Com_Printf("Trying to load \"%s\" from \"%s\"...\n", name, basePath); - Com_sprintf(libPath, sizeof(libPath), "%s%c%s", basePath, PATH_SEP, name); - dllhandle = Sys_LoadLibrary(libPath); + len = Com_sprintf(libPath, sizeof(libPath), "%s%c%s", basePath, PATH_SEP, name); + if(len < sizeof(libPath)) + { + Com_Printf("Trying to load \"%s\" from \"%s\"...\n", name, basePath); + dllhandle = Sys_LoadLibrary(libPath); + } + else + { + Com_Printf("Skipping trying to load \"%s\" from \"%s\", file name is too long.\n", name, basePath); + } } if(!dllhandle) -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git _______________________________________________ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits