summaryrefslogtreecommitdiff
path: root/src/usr.bin/openssl/asn1pars.c
diff options
context:
space:
mode:
authortb <>2023-03-10 09:44:54 +0000
committertb <>2023-03-10 09:44:54 +0000
commite618485baac7a3a801239050e123640f8895eac9 (patch)
tree78fc1e85e2052743372175c9e30021f8e0631373 /src/usr.bin/openssl/asn1pars.c
parentd64f5a4232bfc7642ff1fedc79408b9f7961eaf4 (diff)
downloadopenbsd-e618485baac7a3a801239050e123640f8895eac9.tar.gz
openbsd-e618485baac7a3a801239050e123640f8895eac9.tar.bz2
openbsd-e618485baac7a3a801239050e123640f8895eac9.zip
openssl(1) asn1parse: avoid crash with ASN.1 BOOLEANS
When pointing openssl asn1parse -strparse at DER octets 01 01, it crashes: $ printf '<\x01\x01>' | openssl asn1parse -inform der -strparse 1 Refuse to parse BOOLEAN types instead, which avoids a crash in hensonian /* hmm... this is a little evil, but it works */ code. Found while poking at CMS timestamps to understand one of job's diffs. with/ok jsing
Diffstat (limited to 'src/usr.bin/openssl/asn1pars.c')
-rw-r--r--src/usr.bin/openssl/asn1pars.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/usr.bin/openssl/asn1pars.c b/src/usr.bin/openssl/asn1pars.c
index d6364b5564..3eac72cb66 100644
--- a/src/usr.bin/openssl/asn1pars.c
+++ b/src/usr.bin/openssl/asn1pars.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1pars.c,v 1.14 2023/03/07 05:53:17 tb Exp $ */ 1/* $OpenBSD: asn1pars.c,v 1.15 2023/03/10 09:44:54 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -361,9 +361,10 @@ asn1parse_main(int argc, char **argv)
361 goto end; 361 goto end;
362 } 362 }
363 typ = ASN1_TYPE_get(at); 363 typ = ASN1_TYPE_get(at);
364 if (typ == V_ASN1_OBJECT || typ == V_ASN1_NULL) { 364 if (typ == V_ASN1_BOOLEAN || typ == V_ASN1_NULL ||
365 typ == V_ASN1_OBJECT) {
365 BIO_printf(bio_err, "Can't parse %s type\n", 366 BIO_printf(bio_err, "Can't parse %s type\n",
366 typ == V_ASN1_NULL ? "NULL" : "OBJECT"); 367 ASN1_tag2str(typ));
367 ERR_print_errors(bio_err); 368 ERR_print_errors(bio_err);
368 goto end; 369 goto end;
369 } 370 }