Don't load libraries with non-standard file extensions

Also don't allow writting files ending in a library extension such
as ".so.0" or ".dylib.0".
This commit is contained in:
Zack Middleton 2017-05-24 09:17:39 -05:00
parent fbada2caf6
commit 05858d30e8
6 changed files with 64 additions and 11 deletions

View file

@ -499,11 +499,10 @@ from executable path, then fs_basepath.
void *Sys_LoadDll(const char *name, qboolean useSystemLib)
{
void *dllhandle;
// Don't load any DLLs that end with the pk3 extension
if (COM_CompareExtension(name, ".pk3"))
if(!Sys_DllExtension(name))
{
Com_Printf("Rejecting DLL named \"%s\"", name);
Com_Printf("Refusing to attempt to load library \"%s\": Extension not allowed.\n", name);
return NULL;
}
@ -561,6 +560,12 @@ void *Sys_LoadGameDll(const char *name,
assert(name);
if(!Sys_DllExtension(name))
{
Com_Printf("Refusing to attempt to load library \"%s\": Extension not allowed.\n", name);
return NULL;
}
Com_Printf( "Loading DLL file: %s\n", name);
libHandle = Sys_LoadLibrary(name);