ASN1: Reset the content dump flag after dumping
authorRichard Levitte <levitte@openssl.org>
Sat, 20 Mar 2021 08:09:40 +0000 (09:09 +0100)
committerRichard Levitte <levitte@openssl.org>
Sun, 21 Mar 2021 11:29:06 +0000 (12:29 +0100)
When encountering a badly coded item, the DER printer (ASN1_print_dump())
sets a flag to ensure that an additional hex dump of the offending content
is printed as part of the output.  Unfortunately, this flag is never reset,
which means that all following items are printed with the extra hex dump,
whether they are faulty or not.

Resetting the flag after hex dumping ensures that only the faulty contents
are printed with the additional hex dump.

Fixes #14626

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14627)

crypto/asn1/asn1_par.c

index cf6d48ce101e6fbfa7e854a61d6c87206db46a2e..c51a8f75714fc5f612f2ced9b3e2673836e7c818 100644 (file)
@@ -337,6 +337,7 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
                 }
                 if (BIO_puts(bp, "]") <= 0)
                     goto end;
+                dump_cont = 0;
             }
 
             if (!nl) {