Fix coverity issue: CID 1466483 - Improper use of Negative value in dh_ctrl.c
authorShane Lontis <shane.lontis@oracle.com>
Thu, 10 Sep 2020 08:19:13 +0000 (18:19 +1000)
committerShane Lontis <shane.lontis@oracle.com>
Sat, 12 Sep 2020 05:57:24 +0000 (15:57 +1000)
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/12847)

crypto/dh/dh_ctrl.c

index 6fddd271a889970a6ccab4d55f56e4cbec15c95e..0db5eba50523929831b23dcce62f1f3d65f88bfe 100644 (file)
@@ -500,6 +500,9 @@ int EVP_PKEY_CTX_set0_dh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char *ukm, int len)
     int ret;
     OSSL_PARAM params[2], *p = params;
 
+    if (len <= 0)
+        return -1;
+
     ret = dh_param_derive_check(ctx);
     if (ret != 1)
         return ret;