From 014498fff9ee2e71dfdd82978b8896b05c9c8cb0 Mon Sep 17 00:00:00 2001 From: Pauli Date: Sun, 4 Apr 2021 18:00:26 +1000 Subject: [PATCH] test: fix coverity 1475940: negative return Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/14769) --- test/dhtest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/dhtest.c b/test/dhtest.c index 294c9e3f567..189b5ae13ff 100644 --- a/test/dhtest.c +++ b/test/dhtest.c @@ -249,9 +249,9 @@ static int dh_computekey_range_test(void) || !TEST_true(DH_set0_pqg(dh, p, q, g))) goto err; p = q = g = NULL; - sz = DH_size(dh); - if (!TEST_ptr(buf = OPENSSL_malloc(sz)) + if (!TEST_int_gt(sz = DH_size(dh), 0) + || !TEST_ptr(buf = OPENSSL_malloc(sz)) || !TEST_ptr(pub = BN_new()) || !TEST_ptr(priv = BN_new())) goto err; -- 2.47.2