diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2015-08-25 22:17:03 +0200 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2015-08-25 22:17:43 +0200 |
commit | 4b104ce07070e32363a217a554441a8b4df69d12 (patch) | |
tree | a640ea8b56df1c655e7e8ffa62342cb6c83ab9e8 | |
parent | 859c10beeeaaf1e0a1964118973aca1bc0460a51 (diff) | |
download | cygnal-4b104ce07070e32363a217a554441a8b4df69d12.tar.gz cygnal-4b104ce07070e32363a217a554441a8b4df69d12.tar.bz2 cygnal-4b104ce07070e32363a217a554441a8b4df69d12.zip |
autoload.cc: Drop using full paths for system DLLs
System DLLs are always first in the DLL search order so
http://www.microsoft.com/technet/security/advisory/2269637.mspx
doesn't apply for them.
* autoload.cc (std_dll_init): Revert using full paths to system DLLs.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r-- | winsup/cygwin/ChangeLog | 4 | ||||
-rw-r--r-- | winsup/cygwin/autoload.cc | 14 |
2 files changed, 7 insertions, 11 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index c10d074f1..5df64e135 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,9 @@ 2015-08-25 Corinna Vinschen <corinna@vinschen.de> + * autoload.cc (std_dll_init): Revert using full paths to system DLLs. + +2015-08-25 Corinna Vinschen <corinna@vinschen.de> + * autoload.cc (noload): i686 only: Save and restore $edx when calling SetLastError to avoid clobbering return address stating with Windows 7. diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc index 8f9823b97..f9c0f00cb 100644 --- a/winsup/cygwin/autoload.cc +++ b/winsup/cygwin/autoload.cc @@ -420,18 +420,15 @@ std_dll_init () { fenv_t fpuenv; fegetenv (&fpuenv); - WCHAR dll_path[MAX_PATH]; DWORD err = ERROR_SUCCESS; int i; - /* http://www.microsoft.com/technet/security/advisory/2269637.mspx */ - wcpcpy (wcpcpy (dll_path, windows_system_directory), dll->name); /* MSDN seems to imply that LoadLibrary can fail mysteriously, so, since there have been reports of this in the mailing list, retry several times before giving up. */ for (i = 1; i <= RETRY_COUNT; i++) { /* If loading the library succeeds, just leave the loop. */ - if (dll_load (dll->handle, dll_path)) + if (dll_load (dll->handle, dll->name)) break; /* Otherwise check error code returned by LoadLibrary. If the error code is neither NOACCESS nor DLL_INIT_FAILED, break out @@ -444,15 +441,10 @@ std_dll_init () } if ((uintptr_t) dll->handle <= 1) { - /* If LoadLibrary with full path returns one of the weird errors - reported on the Cygwin mailing list, retry with only the DLL - name. Only do this when the above retry loop has been exhausted. */ - if (i > RETRY_COUNT && dll_load (dll->handle, dll->name)) - /* got it with the fallback */; - else if ((func->decoration & 1)) + if ((func->decoration & 1)) dll->handle = INVALID_HANDLE_VALUE; else - api_fatal ("unable to load %W, %E", dll_path); + api_fatal ("unable to load %W, %E", dll->name); } fesetenv (&fpuenv); } |