Commit 0f6a3ba4 authored by Mikio Hara's avatar Mikio Hara

net: fix possible nil pointer dereference on ReadFrom for windows

Fixes #10516.

Change-Id: Ia93f53d4e752bbcca6112bc75f6c3dbe30b90dac
Reviewed-on: https://go-review.googlesource.com/9192Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 0fc582e8
......@@ -481,8 +481,12 @@ func (fd *netFD) readFrom(buf []byte) (int, syscall.Sockaddr, error) {
o.rsan = int32(unsafe.Sizeof(*o.rsa))
return syscall.WSARecvFrom(o.fd.sysfd, &o.buf, 1, &o.qty, &o.flags, o.rsa, &o.rsan, &o.o, nil)
})
err = fd.eofError(n, err)
if err != nil {
return n, nil, err
}
sa, _ := o.rsa.Sockaddr()
return n, sa, fd.eofError(n, err)
return n, sa, err
}
func (fd *netFD) Write(buf []byte) (int, error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment