diff options
author | Ivan Zhakov <ivan@apache.org> | 2019-05-15 06:00:13 +0000 |
---|---|---|
committer | Ivan Zhakov <ivan@apache.org> | 2019-05-15 06:00:13 +0000 |
commit | b90a57527bbbd2432d04b6644d81866d42194fb1 (patch) | |
tree | 9ce598acfe14dfec097fbc5e42690b758b521c21 | |
parent | 177221333ef3ce3a52dfc4a6d4ece933d024996f (diff) | |
download | apr-b90a57527bbbd2432d04b6644d81866d42194fb1.tar.gz |
win32: Use LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR flag for LoadLibraryExW in
apr_dso() instead of calling SetDllDirectory(). SetDllDirectory() changes
global state and using it may lead to security issues on race conditions.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1859265 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | dso/win32/dso.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/dso/win32/dso.c b/dso/win32/dso.c index 89885e5fa..a2ed9a419 100644 --- a/dso/win32/dso.c +++ b/dso/win32/dso.c @@ -79,17 +79,11 @@ APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle, os_handle = LoadLibraryExW(wpath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (!os_handle) { #ifndef _WIN32_WCE - apr_wchar_t *ignored; - apr_wchar_t fpath[APR_PATH_MAX]; rv = apr_get_os_error(); - if (GetFullPathNameW(wpath, sizeof(fpath) / sizeof(apr_wchar_t), fpath, &ignored)) { - if (SetDllDirectoryW(fpath)) { - os_handle = LoadLibraryExW(wpath, NULL, 0); - if (!os_handle) - os_handle = LoadLibraryExW(wpath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); - if (os_handle) - rv = APR_SUCCESS; - } + + os_handle = LoadLibraryExW(wpath, NULL, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR); + if (os_handle) { + rv = APR_SUCCESS; } #else rv = apr_get_os_error(); |