From ab6175130b67e050725b918d55c0493a9da6663a Mon Sep 17 00:00:00 2001 From: David Horstmann Date: Thu, 27 Oct 2022 11:45:01 +0100 Subject: [PATCH] Fix macro-spanning if in x509_crt.c Signed-off-by: David Horstmann --- library/x509_crt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/x509_crt.c b/library/x509_crt.c index d97c867c0..c7ee5c181 100644 --- a/library/x509_crt.c +++ b/library/x509_crt.c @@ -1258,9 +1258,12 @@ static int x509_crt_parse_der_core( mbedtls_x509_crt *crt, } } + int extensions_allowed = 1; #if !defined(MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3) - if( crt->version == 3 ) + if( crt->version != 3 ) + extensions_allowed = 0; #endif + if( extensions_allowed ) { ret = x509_get_crt_ext( &p, end, crt, cb, p_ctx ); if( ret != 0 )