From: Pauli Date: Mon, 22 Mar 2021 02:33:32 +0000 (+1000) Subject: test: fix coverity 1454812: improper use of negative value X-Git-Tag: openssl-3.0.0-alpha14~160 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51d1991ecd5256aa14a41167a9ac6510e8bd7e93;p=thirdparty%2Fopenssl.git test: fix coverity 1454812: improper use of negative value Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/14638) --- diff --git a/test/clienthellotest.c b/test/clienthellotest.c index 6d7fb499657..04ff4184ae2 100644 --- a/test/clienthellotest.c +++ b/test/clienthellotest.c @@ -185,8 +185,8 @@ static int test_client_hello(int currtest) goto end; } - len = BIO_get_mem_data(wbio, (char **)&data); - if (!TEST_true(PACKET_buf_init(&pkt, data, len)) + if (!TEST_long_ge(len = BIO_get_mem_data(wbio, (char **)&data), 0) + || !TEST_true(PACKET_buf_init(&pkt, data, len)) /* Skip the record header */ || !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH)) goto end;