commit | c7ff727a8c41d2d177a448f398ec625d93dac71b | [log] [tgz] |
---|---|---|
author | Kir Kolyshkin <kolyshkin@gmail.com> | Tue Aug 08 10:31:23 2023 -0700 |
committer | Gopher Robot <gobot@golang.org> | Fri Sep 15 18:45:27 2023 +0000 |
tree | 3bcf80e29e4450b1344494b38937f522a1d136af | |
parent | c7cbcbbfadac68670125ec96cc38e276ce69da74 [diff] |
unix: fix double copy in (*SockaddrALG).sockaddr The code uses ByteSliceFromString first, which - checks that the string does not contain \0; - copies the string to a byte slice which ends with \0. Next, it does one more copy, to sa.raw fields. Double copying is not needed because: - the code already checks that there's an extra byte for \0 in the sa.raw field; - there is no need to check for \0 byte in the middle of the fields (those are hash and cipher names, and an unknown name will result in EINVAL from the kernel). While at it, remove the use of magic numbers. Change-Id: I0cf096fad6f974507d4aa8d429f077000b3bb639 Reviewed-on: https://go-review.googlesource.com/c/sys/+/527836 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
This repository holds supplemental Go packages for low-level interactions with the operating system.
The easiest way to install is to run go get -u golang.org/x/sys
. You can also manually git clone the repository to $GOPATH/src/golang.org/x/sys
.
This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html.
The main issue tracker for the sys repository is located at https://github.com/golang/go/issues. Prefix your issue with “x/sys:” in the subject line, so it is easy to find.