diff options
author | tb <> | 2021-08-24 15:23:03 +0000 |
---|---|---|
committer | tb <> | 2021-08-24 15:23:03 +0000 |
commit | 58d3d45e3a11b8ed8c549067865fb45b7caf7819 (patch) | |
tree | c39cdb8b332be4446a8637c55f18a2a1f4c7ec18 /src/lib/libcrypto/asn1/t_spki.c | |
parent | 252cbe4493634e4a70789ca96794482ba219de91 (diff) | |
download | openbsd-58d3d45e3a11b8ed8c549067865fb45b7caf7819.tar.gz openbsd-58d3d45e3a11b8ed8c549067865fb45b7caf7819.tar.bz2 openbsd-58d3d45e3a11b8ed8c549067865fb45b7caf7819.zip |
Fix various read buffer overflow when printing ASN.1 strings (which are
not necessarily NUL terminated). Same as schwarze's fix in t_x509a.c r1.9.
From David Benjamin and Matt Caswell (part of the fixes in OpenSSL 1.1.1l)
ok inoguchi
Diffstat (limited to 'src/lib/libcrypto/asn1/t_spki.c')
-rw-r--r-- | src/lib/libcrypto/asn1/t_spki.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libcrypto/asn1/t_spki.c b/src/lib/libcrypto/asn1/t_spki.c index 39ff0670b6..7f1ed129cf 100644 --- a/src/lib/libcrypto/asn1/t_spki.c +++ b/src/lib/libcrypto/asn1/t_spki.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: t_spki.c,v 1.11 2014/07/11 08:44:47 jsing Exp $ */ | 1 | /* $OpenBSD: t_spki.c,v 1.12 2021/08/24 15:23:03 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
@@ -94,7 +94,8 @@ NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki) | |||
94 | } | 94 | } |
95 | chal = spki->spkac->challenge; | 95 | chal = spki->spkac->challenge; |
96 | if (chal->length) | 96 | if (chal->length) |
97 | BIO_printf(out, " Challenge String: %s\n", chal->data); | 97 | BIO_printf(out, " Challenge String: %.*s\n", chal->length, |
98 | chal->data); | ||
98 | i = OBJ_obj2nid(spki->sig_algor->algorithm); | 99 | i = OBJ_obj2nid(spki->sig_algor->algorithm); |
99 | BIO_printf(out, " Signature Algorithm: %s", | 100 | BIO_printf(out, " Signature Algorithm: %s", |
100 | (i == NID_undef) ? "UNKNOWN" : OBJ_nid2ln(i)); | 101 | (i == NID_undef) ? "UNKNOWN" : OBJ_nid2ln(i)); |