summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYaroslav Yamshchikov <y.yamshchiko@samsung.com>2019-07-18 10:14:14 (GMT)
committerGleb Balykov <g.balykov@samsung.com>2020-03-25 12:29:41 (GMT)
commitd9fc8fd2d681be8ecd6b0381abe49f26ce8a09b3 (patch)
tree115b3fb98299c3ef3d4cb943309c0399a1ad5529 /src
parent75e112f172ea733b81e5bf325d3139b2f0672260 (diff)
downloadcoreclr-d9fc8fd2d681be8ecd6b0381abe49f26ce8a09b3.zip
coreclr-d9fc8fd2d681be8ecd6b0381abe49f26ce8a09b3.tar.gz
coreclr-d9fc8fd2d681be8ecd6b0381abe49f26ce8a09b3.tar.bz2
add access(2) call before dlopening files
Diffstat (limited to 'src')
-rw-r--r--src/pal/src/loader/module.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/pal/src/loader/module.cpp b/src/pal/src/loader/module.cpp
index dc4c8ba..c817ffe 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)
{