diff options
| author | tb <> | 2021-08-24 15:23:03 +0000 |
|---|---|---|
| committer | tb <> | 2021-08-24 15:23:03 +0000 |
| commit | 52abe2974a6ccf1fbf26a380d1f675aacc9aae28 (patch) | |
| tree | c39cdb8b332be4446a8637c55f18a2a1f4c7ec18 /src/lib/libcrypto/x509/x509_alt.c | |
| parent | 3b5f7f2deeb8133ab932229a210a97daf715b5f1 (diff) | |
| download | openbsd-52abe2974a6ccf1fbf26a380d1f675aacc9aae28.tar.gz openbsd-52abe2974a6ccf1fbf26a380d1f675aacc9aae28.tar.bz2 openbsd-52abe2974a6ccf1fbf26a380d1f675aacc9aae28.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/x509/x509_alt.c')
| -rw-r--r-- | src/lib/libcrypto/x509/x509_alt.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/libcrypto/x509/x509_alt.c b/src/lib/libcrypto/x509/x509_alt.c index 45aaec24c0..5b9f490bae 100644 --- a/src/lib/libcrypto/x509/x509_alt.c +++ b/src/lib/libcrypto/x509/x509_alt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_alt.c,v 1.1 2020/06/04 15:19:31 jsing Exp $ */ | 1 | /* $OpenBSD: x509_alt.c,v 1.2 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. | 3 | * project. |
| 4 | */ | 4 | */ |
| @@ -264,15 +264,18 @@ GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen) | |||
| 264 | break; | 264 | break; |
| 265 | 265 | ||
| 266 | case GEN_EMAIL: | 266 | case GEN_EMAIL: |
| 267 | BIO_printf(out, "email:%s", gen->d.ia5->data); | 267 | BIO_printf(out, "email:%.*s", gen->d.ia5->length, |
| 268 | gen->d.ia5->data); | ||
| 268 | break; | 269 | break; |
| 269 | 270 | ||
| 270 | case GEN_DNS: | 271 | case GEN_DNS: |
| 271 | BIO_printf(out, "DNS:%s", gen->d.ia5->data); | 272 | BIO_printf(out, "DNS:%.*s", gen->d.ia5->length, |
| 273 | gen->d.ia5->data); | ||
| 272 | break; | 274 | break; |
| 273 | 275 | ||
| 274 | case GEN_URI: | 276 | case GEN_URI: |
| 275 | BIO_printf(out, "URI:%s", gen->d.ia5->data); | 277 | BIO_printf(out, "URI:%.*s", gen->d.ia5->length, |
| 278 | gen->d.ia5->data); | ||
| 276 | break; | 279 | break; |
| 277 | 280 | ||
| 278 | case GEN_DIRNAME: | 281 | case GEN_DIRNAME: |
