mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
net/interfaces: trim getPACWindows whitespace before parsing URL
Fixes #2357 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
1e83b97498
commit
440566c5d2
@ -9,6 +9,7 @@
|
|||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
@ -198,6 +199,10 @@ func getPACWindows() string {
|
|||||||
}
|
}
|
||||||
defer globalFree.Call(uintptr(unsafe.Pointer(res)))
|
defer globalFree.Call(uintptr(unsafe.Pointer(res)))
|
||||||
s := windows.UTF16PtrToString(res)
|
s := windows.UTF16PtrToString(res)
|
||||||
|
s = strings.TrimSpace(s)
|
||||||
|
if s == "" {
|
||||||
|
return "" // Issue 2357: invalid URL "\n" from winhttp; ignoring
|
||||||
|
}
|
||||||
if _, err := url.Parse(s); err != nil {
|
if _, err := url.Parse(s); err != nil {
|
||||||
log.Printf("getPACWindows: invalid URL %q from winhttp; ignoring", s)
|
log.Printf("getPACWindows: invalid URL %q from winhttp; ignoring", s)
|
||||||
return ""
|
return ""
|
||||||
|
Loading…
Reference in New Issue
Block a user