From: Gary Lockyer Date: Tue, 28 Apr 2020 23:09:34 +0000 (+1200) Subject: lib util ASN.1: Panic on ASN.1 tag mismatch X-Git-Tag: ldb-2.2.0~559 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ac8000110064055a986c0c1fee896fddd302114b;p=thirdparty%2Fsamba.git lib util ASN.1: Panic on ASN.1 tag mismatch If the ASN.1 depth is zero in asn1_end_tag, call smb_panic. Rather than ignoring the condition. Signed-off-by: Gary Lockyer Reviewed-by: Andrew Bartlett --- diff --git a/lib/util/asn1.c b/lib/util/asn1.c index 397f6b3c271..88d96d4544b 100644 --- a/lib/util/asn1.c +++ b/lib/util/asn1.c @@ -713,9 +713,10 @@ bool asn1_end_tag(struct asn1_data *data) { struct nesting *nesting; - if (data->depth > 0) { - data->depth--; + if (data->depth == 0) { + smb_panic("Unbalanced ASN.1 Tag nesting"); } + data->depth--; /* make sure we read it all */ if (asn1_tag_remaining(data) != 0) { data->has_error = true;