From 4331aa99687a1efcc0968536692de4e8ce5c846b Mon Sep 17 00:00:00 2001 From: John Jiang Date: Thu, 14 Nov 2024 11:35:39 +0800 Subject: [PATCH] TKSS-919: SM2Engine:checkInputBound should check len rather input.length --- .../java/com/tencent/kona/crypto/provider/SM2Engine.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kona-crypto/src/main/java/com/tencent/kona/crypto/provider/SM2Engine.java b/kona-crypto/src/main/java/com/tencent/kona/crypto/provider/SM2Engine.java index 39690435..6d6fd15f 100644 --- a/kona-crypto/src/main/java/com/tencent/kona/crypto/provider/SM2Engine.java +++ b/kona-crypto/src/main/java/com/tencent/kona/crypto/provider/SM2Engine.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022, 2023, THL A29 Limited, a Tencent company. All rights reserved. + * Copyright (C) 2022, 2024, THL A29 Limited, a Tencent company. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify @@ -258,8 +258,8 @@ private byte[] kdf(byte[] input, int keyLen) { } private static boolean checkInputBound(byte[] input, int offset, int len) { - return input != null && input.length > 0 - && offset >= 0 && len >= 0 + return input != null + && offset >= 0 && len > 0 && (input.length >= (offset + len)); } }