From 52e85dac2f69202ffc47062f1eaa50870c974799 Mon Sep 17 00:00:00 2001 From: Yaroslav Yamshchikov Date: Thu, 18 Jul 2019 13:14:14 +0300 Subject: [PATCH] [Tizen] add access(2) call before dlopening files --- src/coreclr/pal/src/loader/module.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/coreclr/pal/src/loader/module.cpp b/src/coreclr/pal/src/loader/module.cpp index f9d6acb..dff51fe 100644 --- a/src/coreclr/pal/src/loader/module.cpp +++ b/src/coreclr/pal/src/loader/module.cpp @@ -1476,6 +1476,16 @@ 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; + } + } + dl_handle = dlopen(libraryNameOrPath, RTLD_LAZY); } -- 2.7.4