From 80fa88e2fab1850e2b5eb38eb8bc2759a7606269 Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Fri, 24 Nov 2023 17:12:24 +0000 Subject: [PATCH] Remove warning with GCC 12 and TSan Compiler is unhappy that the return from mbedtls_cipher_get_name() could be NULL as this is used in a printf statement. Signed-off-by: Paul Elliott --- programs/aes/crypt_and_hash.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/programs/aes/crypt_and_hash.c b/programs/aes/crypt_and_hash.c index 226718bc63..f15b85e2c0 100644 --- a/programs/aes/crypt_and_hash.c +++ b/programs/aes/crypt_and_hash.c @@ -103,7 +103,14 @@ int main(int argc, char *argv[]) list = mbedtls_cipher_list(); while (*list) { cipher_info = mbedtls_cipher_info_from_type(*list); - mbedtls_printf(" %s\n", mbedtls_cipher_info_get_name(cipher_info)); + if (cipher_info) { + const char *name = mbedtls_cipher_info_get_name(cipher_info); + + if (name) { + mbedtls_printf(" %s\n", mbedtls_cipher_info_get_name(cipher_info)); + } + } + list++; }