From 06a0d40322e96dbba816b35f82226871f635ec5a Mon Sep 17 00:00:00 2001 From: Bernd Edlinger Date: Fri, 21 Jul 2023 07:34:39 +0200 Subject: [PATCH] Fix error handling in pipelining test 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 Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/21512) --- test/sslapitest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sslapitest.c b/test/sslapitest.c index 28ed079fd6fc1..f29f1289c9885 100644 --- a/test/sslapitest.c +++ b/test/sslapitest.c @@ -10851,7 +10851,7 @@ static int test_pipelining(int idx) ENGINE_finish(e); ENGINE_free(e); OPENSSL_free(buf); - if (idx == 5) + if (fragsize == SSL3_RT_MAX_PLAIN_LENGTH) OPENSSL_free(msg); return testresult; }