all: use Go 1.20's bytes.Clone
Updates #7123 Updates #6257 (more to do in other repos) Change-Id: I073e2a6d81a5d7fbecc29caddb7e057ff65239d0 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
f7b3156f16
commit
cf8dd7aa09
@ -4,6 +4,7 @@
|
||||
package key
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/subtle"
|
||||
"encoding/hex"
|
||||
|
||||
@ -86,7 +87,7 @@ func (k *MachinePrivate) UnmarshalText(b []byte) error {
|
||||
// specific raw byte serialization, please use
|
||||
// MarshalText/UnmarshalText.
|
||||
func (k MachinePrivate) UntypedBytes() []byte {
|
||||
return append([]byte(nil), k.k[:]...)
|
||||
return bytes.Clone(k.k[:])
|
||||
}
|
||||
|
||||
// SealTo wraps cleartext into a NaCl box (see
|
||||
@ -230,7 +231,7 @@ func (k MachinePublic) UntypedHexString() string {
|
||||
// specific raw byte serialization, please use
|
||||
// MarshalText/UnmarshalText.
|
||||
func (k MachinePublic) UntypedBytes() []byte {
|
||||
return append([]byte(nil), k.k[:]...)
|
||||
return bytes.Clone(k.k[:])
|
||||
}
|
||||
|
||||
// String returns the output of MarshalText as a string.
|
||||
|
Reference in New Issue
Block a user