From 33c55a90e323620dbe67f0074668af8484c74960 Mon Sep 17 00:00:00 2001 From: Ben Taylor Date: Mon, 8 Jun 2026 15:32:26 +0100 Subject: [PATCH] Improve test of non-initilisation of lifetime Signed-off-by: Ben Taylor --- tests/suites/test_suite_ssl.function | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/suites/test_suite_ssl.function b/tests/suites/test_suite_ssl.function index a93904a2b6..34c4d89e00 100644 --- a/tests/suites/test_suite_ssl.function +++ b/tests/suites/test_suite_ssl.function @@ -6427,12 +6427,13 @@ void write_new_session_ticket_mem() ret = mbedtls_ssl_handshake_step(&(server_ep.ssl)); TEST_EQUAL(ret, 0); -#if defined(MBEDTLS_TEST_HAVE_MSAN) - { - volatile unsigned char lifetime_byte = server_ep.ssl.out_msg[4]; - TEST_ASSERT(lifetime_byte != 0xff); - } -#endif + /* Force a read of the lifetime value from the outgoing message. + * This is a non-regression test for a bug where the lifetime was set from + * uninitialized memory. + * The read here causes MSan and Valgrind to complain if the bug isn't fixed. + */ + volatile unsigned char lifetime = MBEDTLS_GET_UINT32_BE(server_ep.ssl.out_msg + 4); + (void) lifetime; exit: mbedtls_test_ssl_endpoint_free(&client_ep);