New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
syscall: unix Sendto panic if nil Sockaddr provided #55845
Comments
I think it would make sense to add the check for /cc @ianlancetaylor |
Change https://go.dev/cl/433504 mentions this issue: |
Change https://go.dev/cl/434515 mentions this issue: |
Change https://go.dev/cl/434535 mentions this issue: |
Same as CL 433504 did for the syscall package. For golang/go#55845 Change-Id: I3ca2d7fab9da77c304487b4c134a9675da99deca Reviewed-on: https://go-review.googlesource.com/c/sys/+/434515 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
to is an optional pointer to sockaddr, as written in the doc: https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasendto For #55845 Change-Id: Ia685cec8d9bc9ff313f598db9d2213a1f409757a Reviewed-on: https://go-review.googlesource.com/c/go/+/434535 Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: xie cui <523516579@qq.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Change https://go.dev/cl/435777 mentions this issue: |
Same as CL 434535 did for the syscall package. For golang/go#55845 Change-Id: I17f30152ae973b64ac65e08cefd5442e9bf19e2c Reviewed-on: https://go-review.googlesource.com/c/sys/+/435777 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Benny Siegert <bsiegert@gmail.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Benny Siegert <bsiegert@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
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
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
the
nil
situation forto
is not tested, thus a panic() occurs.Suggestion
is it possible to add a test to avoid a panic() when
to
is set tonil
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
The text was updated successfully, but these errors were encountered: