From: qiulaidongfeng <2645477756@qq.com> Date: Fri, 16 Feb 2024 10:24:55 +0000 (+0000) Subject: crypto/subtle: use min builtin function in XORBytes X-Git-Tag: go1.23rc1~1220 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=6e5080470c184da64b021708545da984301a3eb8;p=gostls13.git crypto/subtle: use min builtin function in XORBytes Change-Id: Ibf57dbaaa54486823e0769714dec2e22d6c5ea9e GitHub-Last-Rev: 31421d066833f721f3fa261ac9dc49724fffb5f8 GitHub-Pull-Request: golang/go#65748 Reviewed-on: https://go-review.googlesource.com/c/go/+/564577 LUCI-TryBot-Result: Go LUCI Reviewed-by: Filippo Valsorda Reviewed-by: Damien Neil Auto-Submit: Filippo Valsorda Reviewed-by: Than McIntosh --- diff --git a/src/crypto/subtle/xor.go b/src/crypto/subtle/xor.go index a8805ac61d..158dbcede9 100644 --- a/src/crypto/subtle/xor.go +++ b/src/crypto/subtle/xor.go @@ -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 }