You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 <[email protected]>
Auto-Submit: Ian Lance Taylor <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Run-TryBot: Kirill Kolyshkin <[email protected]>
Reviewed-by: Bryan Mills <[email protected]>
Reviewed-by: Tobias Klauser <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
0 commit comments