mirror of
https://github.com/rehlds/rehlds.git
synced 2025-02-27 14:01:18 +03:00
Merge pull request #520 from WPMGPRoSToTeMa/safeloading
Make DLL loading more safe
This commit is contained in:
commit
3c036eda31
@ -227,7 +227,11 @@ long CSys::LoadLibrary(char *lib)
|
||||
|
||||
Q_snprintf(absolute_lib, sizeof(absolute_lib), "%s/%s", cwd, lib);
|
||||
|
||||
#ifdef LAUNCHER_FIXES
|
||||
void *hDll = dlopen(absolute_lib, RTLD_NOW | RTLD_DEEPBIND | RTLD_LOCAL);
|
||||
#else // LAUNCHER_FIXES
|
||||
void *hDll = dlopen(absolute_lib, RTLD_NOW);
|
||||
#endif // LAUNCHER_FIXES
|
||||
if (!hDll)
|
||||
{
|
||||
ErrorMessage(1, dlerror());
|
||||
|
@ -330,7 +330,7 @@ void *FS_LoadLibrary(const char *dllName)
|
||||
#ifdef _WIN32
|
||||
result = LoadLibraryA(dllName);
|
||||
#else
|
||||
result = dlopen(dllName, 2);
|
||||
result = dlopen(dllName, RTLD_NOW);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1067,7 +1067,11 @@ void LoadThisDll(const char *szDllFilename)
|
||||
goto IgnoreThisDLL;
|
||||
}
|
||||
#else // _WIN32
|
||||
#ifdef REHLDS_FIXES
|
||||
void *hDLL = dlopen(szDllFilename, RTLD_NOW | RTLD_DEEPBIND | RTLD_LOCAL);
|
||||
#else // REHLDS_FIXES
|
||||
void *hDLL = dlopen(szDllFilename, RTLD_NOW);
|
||||
#endif // REHLDS_FIXES
|
||||
if (!hDLL)
|
||||
{
|
||||
Con_Printf("LoadLibrary failed on %s: %s\n", szDllFilename, dlerror());
|
||||
|
Loading…
x
Reference in New Issue
Block a user