From: Pauli Date: Mon, 22 Mar 2021 01:49:56 +0000 (+1000) Subject: test: fix coverity 1371689 & 1371690: improper use of negative values X-Git-Tag: openssl-3.0.0-alpha14~163 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fe10fa75216cb0e81eeee9bced2b4d26e05bf9e7;p=thirdparty%2Fopenssl.git test: fix coverity 1371689 & 1371690: improper use of negative values Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/14638) --- diff --git a/test/bad_dtls_test.c b/test/bad_dtls_test.c index 524ec52cf01..52333e860c5 100644 --- a/test/bad_dtls_test.c +++ b/test/bad_dtls_test.c @@ -122,7 +122,8 @@ static int validate_client_hello(BIO *wbio) int cookie_found = 0; unsigned int u = 0; - len = BIO_get_mem_data(wbio, (char **)&data); + if ((len = BIO_get_mem_data(wbio, (char **)&data)) < 0) + return 0; if (!PACKET_buf_init(&pkt, data, len)) return 0; @@ -391,6 +392,9 @@ static int validate_ccs(BIO *wbio) unsigned int u; len = BIO_get_mem_data(wbio, (char **)&data); + if (len < 0) + return 0; + if (!PACKET_buf_init(&pkt, data, len)) return 0;