Skip to content

Commit 0f6a3ba

Browse files
committed
net: fix possible nil pointer dereference on ReadFrom for windows
Fixes #10516. Change-Id: Ia93f53d4e752bbcca6112bc75f6c3dbe30b90dac Reviewed-on: https://go-review.googlesource.com/9192 Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 0fc582e commit 0f6a3ba

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/net/fd_windows.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,12 @@ func (fd *netFD) readFrom(buf []byte) (int, syscall.Sockaddr, error) {
481481
o.rsan = int32(unsafe.Sizeof(*o.rsa))
482482
return syscall.WSARecvFrom(o.fd.sysfd, &o.buf, 1, &o.qty, &o.flags, o.rsa, &o.rsan, &o.o, nil)
483483
})
484+
err = fd.eofError(n, err)
485+
if err != nil {
486+
return n, nil, err
487+
}
484488
sa, _ := o.rsa.Sockaddr()
485-
return n, sa, fd.eofError(n, err)
489+
return n, sa, err
486490
}
487491

488492
func (fd *netFD) Write(buf []byte) (int, error) {

0 commit comments

Comments
 (0)