]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
test: fix coverity 1451574: improper use of negative value
authorPauli <ppzgs1@gmail.com>
Mon, 22 Mar 2021 02:31:43 +0000 (12:31 +1000)
committerPauli <ppzgs1@gmail.com>
Tue, 23 Mar 2021 23:12:43 +0000 (09:12 +1000)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14638)

test/sslapitest.c

index edaadb170f437c01e6a95c4c4c1ca5deb18fd1f8..3e5d532bf4fb17305fca4a4e4e4e3f36ce30a369 100644 (file)
@@ -5960,7 +5960,8 @@ static int get_MFL_from_client_hello(BIO *bio, int *mfl_codemfl_code)
     memset(&pkt2, 0, sizeof(pkt2));
     memset(&pkt3, 0, sizeof(pkt3));
 
-    if (!TEST_true( PACKET_buf_init( &pkt, data, len ) )
+    if (!TEST_long_gt(len, 0)
+            || !TEST_true( PACKET_buf_init( &pkt, data, len ) )
                /* Skip the record header */
             || !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH)
                /* Skip the handshake message header */