mirror of
https://github.com/rehlds/rehlds.git
synced 2025-02-27 22:11:07 +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);
|
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);
|
void *hDll = dlopen(absolute_lib, RTLD_NOW);
|
||||||
|
#endif // LAUNCHER_FIXES
|
||||||
if (!hDll)
|
if (!hDll)
|
||||||
{
|
{
|
||||||
ErrorMessage(1, dlerror());
|
ErrorMessage(1, dlerror());
|
||||||
|
@ -330,7 +330,7 @@ void *FS_LoadLibrary(const char *dllName)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
result = LoadLibraryA(dllName);
|
result = LoadLibraryA(dllName);
|
||||||
#else
|
#else
|
||||||
result = dlopen(dllName, 2);
|
result = dlopen(dllName, RTLD_NOW);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1067,7 +1067,11 @@ void LoadThisDll(const char *szDllFilename)
|
|||||||
goto IgnoreThisDLL;
|
goto IgnoreThisDLL;
|
||||||
}
|
}
|
||||||
#else // _WIN32
|
#else // _WIN32
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
void *hDLL = dlopen(szDllFilename, RTLD_NOW | RTLD_DEEPBIND | RTLD_LOCAL);
|
||||||
|
#else // REHLDS_FIXES
|
||||||
void *hDLL = dlopen(szDllFilename, RTLD_NOW);
|
void *hDLL = dlopen(szDllFilename, RTLD_NOW);
|
||||||
|
#endif // REHLDS_FIXES
|
||||||
if (!hDLL)
|
if (!hDLL)
|
||||||
{
|
{
|
||||||
Con_Printf("LoadLibrary failed on %s: %s\n", szDllFilename, dlerror());
|
Con_Printf("LoadLibrary failed on %s: %s\n", szDllFilename, dlerror());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user