diff options
-rw-r--r-- | src/pal/src/loader/module.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/pal/src/loader/module.cpp b/src/pal/src/loader/module.cpp index dc4c8babf0..c817ffe2db 100644 --- a/src/pal/src/loader/module.cpp +++ b/src/pal/src/loader/module.cpp @@ -1428,6 +1428,15 @@ static NATIVE_LIBRARY_HANDLE LOADLoadLibraryDirect(LPCSTR libraryNameOrPath) _ASSERTE(libraryNameOrPath != nullptr); _ASSERTE(libraryNameOrPath[0] != '\0'); + if (strchr(libraryNameOrPath, '/') != nullptr) + { + if (access(libraryNameOrPath, F_OK) == -1) + { + SetLastError(ERROR_MOD_NOT_FOUND); + return (NATIVE_LIBRARY_HANDLE)nullptr; + } + } + NATIVE_LIBRARY_HANDLE dl_handle = dlopen(libraryNameOrPath, RTLD_LAZY); if (dl_handle == nullptr) { |