aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/export_windows_test.go
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2016-03-25 06:40:58 +0000
committerBrad Fitzpatrick <bradfitz@golang.org>2016-04-01 22:55:36 +0000
commit683448a304a3871039ab44fc01e839f05ac36f05 (patch)
tree7e97c203c9b5cbbbbe9da7b0ff730590488fa1ac /src/runtime/export_windows_test.go
parent59fc42b230671d083feb68925d9cadc1da1d2616 (diff)
downloadgo-683448a304a3871039ab44fc01e839f05ac36f05.tar.gz
go-683448a304a3871039ab44fc01e839f05ac36f05.zip
runtime, syscall: only search for Windows DLLs in the System32 directory
Make sure that for any DLL that Go uses itself, we only look for the DLL in the Windows System32 directory, guarding against DLL preloading attacks. (Unless the Windows version is ancient and LoadLibraryEx is unavailable, in which case the user probably has bigger security problems anyway.) This does not change the behavior of syscall.LoadLibrary or NewLazyDLL if the DLL name is something unused by Go itself. This change also intentionally does not add any new API surface. Instead, x/sys is updated with a LoadLibraryEx function and LazyDLL.Flags in: https://golang.org/cl/21388 Updates #14959 Change-Id: I8d29200559cc19edf8dcf41dbdd39a389cd6aeb9 Reviewed-on: https://go-review.googlesource.com/21140 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/export_windows_test.go')
-rw-r--r--src/runtime/export_windows_test.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/runtime/export_windows_test.go b/src/runtime/export_windows_test.go
index 9e744fc35f..dbca8d636e 100644
--- a/src/runtime/export_windows_test.go
+++ b/src/runtime/export_windows_test.go
@@ -15,3 +15,7 @@ func NumberOfProcessors() int32 {
stdcall1(_GetSystemInfo, uintptr(unsafe.Pointer(&info)))
return int32(info.dwnumberofprocessors)
}
+
+func LoadLibraryExStatus() (useEx, haveEx, haveFlags bool) {
+ return useLoadLibraryEx, _LoadLibraryExW != nil, _AddDllDirectory != nil
+}