-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.help wanted
Milestone
Description
What version of Go are you using (go version
)?
1.19.1
Does this issue reproduce with the latest release?
yes.
What operating system and processor architecture are you using (go env
)?
ubuntu linux 22.04 on amd64
What did you do?
syscall.Sendto(socket, buffer, flag, nil)
What did you expect to see?
as specified in https://linux.die.net/man/2/sendto
send(sockfd, buf, len, flags);
is equivalent to
sendto(sockfd, buf, len, flags, NULL, 0);
What did you see instead?
we can see in https://cs.opensource.google/go/go/+/refs/tags/go1.19.1:src/syscall/syscall_unix.go;l=445
func Sendto(fd int, p []byte, flags int, to Sockaddr) (err error) {
ptr, n, err := to.sockaddr()
if err != nil {
return err
}
return sendto(fd, p, flags, ptr, n)
}
the nil
situation for to
is not tested, thus a panic() occurs.
Suggestion
is it possible to add a test to avoid a panic() when to
is set to nil
like in SendmsgN() ( see: https://cs.opensource.google/go/go/+/refs/tags/go1.19.1:src/syscall/syscall_unix.go;l=400 ) ?
this issue may also impact :
– SendtoInet4
– SendtoInet6
– SendmsgNInet4
– SendmsgNInet6
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.help wanted