diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-03-03 14:38:26 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-03-08 21:04:09 -0700 |
commit | 497ba95de7833566d696768c8a366e39fdb40f8b (patch) | |
tree | 2eae133ac40b551c6ec41af7d2d72b1c4dc8367c /tun/wintun/memmod/memmod_windows.go | |
parent | conn: linux: unexport mutex (diff) | |
download | wireguard-go-497ba95de7833566d696768c8a366e39fdb40f8b.tar.xz wireguard-go-497ba95de7833566d696768c8a366e39fdb40f8b.zip |
memmod: do not use IsBadReadPtr
It should be enough to check for the trailing zero name.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'tun/wintun/memmod/memmod_windows.go')
-rw-r--r-- | tun/wintun/memmod/memmod_windows.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tun/wintun/memmod/memmod_windows.go b/tun/wintun/memmod/memmod_windows.go index a9514c4..c75de5a 100644 --- a/tun/wintun/memmod/memmod_windows.go +++ b/tun/wintun/memmod/memmod_windows.go @@ -312,7 +312,7 @@ func (module *Module) buildImportTable() error { module.modules = make([]windows.Handle, 0, 16) importDesc := (*IMAGE_IMPORT_DESCRIPTOR)(a2p(module.codeBase + uintptr(directory.VirtualAddress))) - for !isBadReadPtr(uintptr(unsafe.Pointer(importDesc)), unsafe.Sizeof(*importDesc)) && importDesc.Name != 0 { + for importDesc.Name != 0 { handle, err := windows.LoadLibraryEx(windows.BytePtrToString((*byte)(a2p(module.codeBase+uintptr(importDesc.Name)))), 0, windows.LOAD_LIBRARY_SEARCH_SYSTEM32) if err != nil { return fmt.Errorf("Error loading module: %w", err) |