Fix error handling in pipelining test
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Fri, 21 Jul 2023 05:34:39 +0000 (07:34 +0200)
committerTomas Mraz <tomas@openssl.org>
Mon, 24 Jul 2023 09:02:26 +0000 (11:02 +0200)
When an early error happens in the test_pipelining
function and idx == 5 the error handling would try
to call OPENSSL_free(msg), but msg is at that time
just a string constant in read-only memory, so a
crash would be the result. Fixed that by using
fragsize as an indication when to free msg.

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21512)

test/sslapitest.c

index 28ed079fd6fc1f8e1c111afe38fbd34b796adc58..f29f1289c9885ff31e332d7b9349894f811eff2f 100644 (file)
@@ -10851,7 +10851,7 @@ end:
     ENGINE_finish(e);
     ENGINE_free(e);
     OPENSSL_free(buf);
-    if (idx == 5)
+    if (fragsize == SSL3_RT_MAX_PLAIN_LENGTH)
         OPENSSL_free(msg);
     return testresult;
 }