From 35b86a872f5595f91bdc637ac191290ee3f23bd2 Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Tue, 25 Jun 2019 09:50:07 +0100 Subject: [PATCH] [FIXUP] Fix bug in ASN.1 traversal of silently ignored tag --- library/asn1parse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/asn1parse.c b/library/asn1parse.c index 68a70e61f..aac253b01 100644 --- a/library/asn1parse.c +++ b/library/asn1parse.c @@ -273,11 +273,11 @@ int mbedtls_asn1_traverse_sequence_of( if( ( tag & tag_must_mask ) != tag_must_val ) return( MBEDTLS_ERR_ASN1_UNEXPECTED_TAG ); + if( ( ret = mbedtls_asn1_get_len( p, end, &len ) ) != 0 ) + return( ret ); + if( ( tag & tag_may_mask ) == tag_may_val ) { - if( ( ret = mbedtls_asn1_get_len( p, end, &len ) ) != 0 ) - return( ret ); - if( cb != NULL ) { ret = cb( ctx, tag, *p, len );