crypto/subtle: use min in XORBytes

Change-Id: Ib06fc808baf248433f569a52d4340f30a2a56ead
This commit is contained in:
qiulaidongfeng 2024-02-16 17:45:54 +08:00
parent 185f31bf30
commit 31421d0668
1 changed files with 1 additions and 4 deletions

View File

@ -9,10 +9,7 @@ package subtle
// If dst does not have length at least n,
// XORBytes panics without writing anything to dst.
func XORBytes(dst, x, y []byte) int {
n := len(x)
if len(y) < n {
n = len(y)
}
n := min(len(x), len(y))
if n == 0 {
return 0
}