From 6e5080470c184da64b021708545da984301a3eb8 Mon Sep 17 00:00:00 2001 From: qiulaidongfeng <2645477756@qq.com> Date: Fri, 16 Feb 2024 10:24:55 +0000 Subject: [PATCH] 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 --- src/crypto/subtle/xor.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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 } -- 2.48.1