summaryrefslogtreecommitdiffstats
path: root/test/dhtest.c
diff options
context:
space:
mode:
authorPauli <ppzgs1@gmail.com>2021-03-19 14:49:42 +1000
committerPauli <pauli@openssl.org>2021-04-08 08:49:27 +1000
commit89f7ea045be346ecd9085804a429bb4842843344 (patch)
treea225cb5dc7e859f8b6bf5f6366ddfeaa7c06e823 /test/dhtest.c
parent41385f2708d08155d56ce08dce494152e225069e (diff)
test: fix coverity 1473234 & 1473239: argument cannot be negative
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14620)
Diffstat (limited to 'test/dhtest.c')
-rw-r--r--test/dhtest.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/dhtest.c b/test/dhtest.c
index 189b5ae13f..b5ff81a319 100644
--- a/test/dhtest.c
+++ b/test/dhtest.c
@@ -666,12 +666,12 @@ static int rfc7919_test(void)
DH_get0_key(b, &bpub_key, NULL);
alen = DH_size(a);
- if (!TEST_ptr(abuf = OPENSSL_malloc(alen))
+ if (!TEST_int_gt(alen, 0) || !TEST_ptr(abuf = OPENSSL_malloc(alen))
|| !TEST_true((aout = DH_compute_key(abuf, bpub_key, a)) != -1))
goto err;
blen = DH_size(b);
- if (!TEST_ptr(bbuf = OPENSSL_malloc(blen))
+ if (!TEST_int_gt(blen, 0) || !TEST_ptr(bbuf = OPENSSL_malloc(blen))
|| !TEST_true((bout = DH_compute_key(bbuf, apub_key, b)) != -1))
goto err;