mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
internal/poll: permit nil destination address in WriteMsg{Inet4,Inet6}
For #74841 Change-Id: If2ea23b1eb23e32680bd576f54a0020d7e115797 Reviewed-on: https://go-review.googlesource.com/c/go/+/692436 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
parent
9b0a507735
commit
13c082601d
1 changed files with 10 additions and 4 deletions
|
|
@ -1422,10 +1422,13 @@ func (fd *FD) WriteMsgInet4(p []byte, oob []byte, sa *syscall.SockaddrInet4) (in
|
|||
if o.rsa == nil {
|
||||
o.rsa = new(syscall.RawSockaddrAny)
|
||||
}
|
||||
len := sockaddrInet4ToRaw(o.rsa, sa)
|
||||
var nameLen int32
|
||||
if sa != nil {
|
||||
nameLen = sockaddrInet4ToRaw(o.rsa, sa)
|
||||
}
|
||||
msg := newWSAMsg(p, oob, 0)
|
||||
msg.Name = (syscall.Pointer)(unsafe.Pointer(o.rsa))
|
||||
msg.Namelen = len
|
||||
msg.Namelen = nameLen
|
||||
n, err := fd.execIO(o, func(o *operation) (qty uint32, err error) {
|
||||
err = windows.WSASendMsg(fd.Sysfd, &msg, 0, nil, &o.o, nil)
|
||||
return qty, err
|
||||
|
|
@ -1449,9 +1452,12 @@ func (fd *FD) WriteMsgInet6(p []byte, oob []byte, sa *syscall.SockaddrInet6) (in
|
|||
o.rsa = new(syscall.RawSockaddrAny)
|
||||
}
|
||||
msg := newWSAMsg(p, oob, 0)
|
||||
len := sockaddrInet6ToRaw(o.rsa, sa)
|
||||
var nameLen int32
|
||||
if sa != nil {
|
||||
nameLen = sockaddrInet6ToRaw(o.rsa, sa)
|
||||
}
|
||||
msg.Name = (syscall.Pointer)(unsafe.Pointer(o.rsa))
|
||||
msg.Namelen = len
|
||||
msg.Namelen = nameLen
|
||||
n, err := fd.execIO(o, func(o *operation) (qty uint32, err error) {
|
||||
err = windows.WSASendMsg(fd.Sysfd, &msg, 0, nil, &o.o, nil)
|
||||
return qty, err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue