summaryrefslogtreecommitdiffstats
path: root/crypto/dh
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2022-08-22 11:06:57 +1000
committerPauli <pauli@openssl.org>2022-08-23 18:02:57 +1000
commiteb7a5cc3454174094c0c09f1d00aec464ce0f786 (patch)
treeeff6628354afe46aaac09543ea5b8a757af7a38d /crypto/dh
parent52f616990537b22b0ec81475207caef25fdc0886 (diff)
Coverity 1508532: out of bounds access
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19033)
Diffstat (limited to 'crypto/dh')
-rw-r--r--crypto/dh/dh_pmeth.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/dh/dh_pmeth.c b/crypto/dh/dh_pmeth.c
index 1ad50b850d..bd7902c433 100644
--- a/crypto/dh/dh_pmeth.c
+++ b/crypto/dh/dh_pmeth.c
@@ -432,7 +432,8 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
else if (dctx->kdf_type == EVP_PKEY_DH_KDF_X9_42) {
unsigned char *Z = NULL;
- size_t Zlen = 0;
+ int Zlen = 0;
+
if (!dctx->kdf_outlen || !dctx->kdf_oid)
return 0;
if (key == NULL) {