You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by iv...@apache.org on 2019/05/15 06:00:14 UTC

svn commit: r1859265 - /apr/apr/trunk/dso/win32/dso.c

Author: ivan
Date: Wed May 15 06:00:13 2019
New Revision: 1859265

URL: http://svn.apache.org/viewvc?rev=1859265&view=rev
Log:
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.

Modified:
    apr/apr/trunk/dso/win32/dso.c

Modified: apr/apr/trunk/dso/win32/dso.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/dso/win32/dso.c?rev=1859265&r1=1859264&r2=1859265&view=diff
==============================================================================
--- apr/apr/trunk/dso/win32/dso.c (original)
+++ apr/apr/trunk/dso/win32/dso.c Wed May 15 06:00:13 2019
@@ -79,17 +79,11 @@ APR_DECLARE(apr_status_t) apr_dso_load(s
             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();