diff options
author | Gary Lockyer <gary@catalyst.net.nz> | 2020-04-29 11:09:34 +1200 |
---|---|---|
committer | Gary Lockyer <gary@samba.org> | 2020-05-10 21:45:38 +0000 |
commit | ac8000110064055a986c0c1fee896fddd302114b (patch) | |
tree | 40b761c94d0e8e2023839f19867b543118611640 /lib/util | |
parent | 80d9ea1386707c33783b76e5bc4ec37523424439 (diff) | |
download | samba-ac8000110064055a986c0c1fee896fddd302114b.tar.gz |
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 <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib/util')
-rw-r--r-- | lib/util/asn1.c | 5 |
1 files changed, 3 insertions, 2 deletions
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; |