@@ -4590,7 +4590,7 @@ int test_tls13_empty_record_limit(void)
45904590 struct test_memio_ctx test_ctx ;
45914591 WOLFSSL_CTX * ctx_c = NULL , * ctx_s = NULL ;
45924592 WOLFSSL * ssl_c = NULL , * ssl_s = NULL ;
4593- int recSz ;
4593+ int recSz = 0 ;
45944594 /* Send exactly WOLFSSL_MAX_EMPTY_RECORDS to pin the boundary check.
45954595 * The Nth record increments the counter to N, and `N >= N` triggers
45964596 * the error. Sending one more would let a `>=` -> `>` mutation survive
@@ -4608,16 +4608,18 @@ int test_tls13_empty_record_limit(void)
46084608
46094609 ExpectIntEQ (test_memio_do_handshake (ssl_c , ssl_s , 10 , NULL ), 0 );
46104610
4611- /* Consume any post-handshake messages (e.g. NewSessionTicket). */
4612- wolfSSL_read (ssl_c , buf , sizeof (buf ));
4613- test_memio_clear_buffer (& test_ctx , 0 );
4614- test_memio_clear_buffer (& test_ctx , 1 );
4615-
4616- /* Get the size of an encrypted zero-length app data record. */
4617- recSz = BuildTls13Message (ssl_c , NULL , 0 , NULL , 0 ,
4618- application_data , 0 , 1 , 0 );
4619- ExpectIntGT (recSz , 0 );
4620- ExpectIntLE (recSz , (int )sizeof (rec ));
4611+ if (EXPECT_SUCCESS ()) {
4612+ /* Consume any post-handshake messages (e.g. NewSessionTicket). */
4613+ wolfSSL_read (ssl_c , buf , sizeof (buf ));
4614+ test_memio_clear_buffer (& test_ctx , 0 );
4615+ test_memio_clear_buffer (& test_ctx , 1 );
4616+
4617+ /* Get the size of an encrypted zero-length app data record. */
4618+ recSz = BuildTls13Message (ssl_c , NULL , 0 , NULL , 0 ,
4619+ application_data , 0 , 1 , 0 );
4620+ ExpectIntGT (recSz , 0 );
4621+ ExpectIntLE (recSz , (int )sizeof (rec ));
4622+ }
46214623
46224624 /* Build all empty records into one contiguous buffer. */
46234625 if (EXPECT_SUCCESS ()) {
@@ -4664,15 +4666,17 @@ int test_tls13_empty_record_limit(void)
46644666
46654667 ExpectIntEQ (test_memio_do_handshake (ssl_c , ssl_s , 10 , NULL ), 0 );
46664668
4667- wolfSSL_read (ssl_c , buf , sizeof (buf ));
4668- test_memio_clear_buffer (& test_ctx , 0 );
4669- test_memio_clear_buffer (& test_ctx , 1 );
4669+ if (EXPECT_SUCCESS ()) {
4670+ wolfSSL_read (ssl_c , buf , sizeof (buf ));
4671+ test_memio_clear_buffer (& test_ctx , 0 );
4672+ test_memio_clear_buffer (& test_ctx , 1 );
46704673
4671- recSz = BuildTls13Message (ssl_c , NULL , 0 , NULL , 0 ,
4672- application_data , 0 , 1 , 0 );
4673- ExpectIntGT (recSz , 0 );
4674+ recSz = BuildTls13Message (ssl_c , NULL , 0 , NULL , 0 ,
4675+ application_data , 0 , 1 , 0 );
4676+ ExpectIntGT (recSz , 0 );
4677+ }
46744678
4675- {
4679+ if ( EXPECT_SUCCESS ()) {
46764680 int emptyBefore = WOLFSSL_MAX_EMPTY_RECORDS - 1 ;
46774681 int emptyAfter = WOLFSSL_MAX_EMPTY_RECORDS - 1 ;
46784682 int dataRecSz ;
0 commit comments