summaryrefslogtreecommitdiffstats
path: root/crypto/x509/v3_pci.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2021-08-18 14:02:40 +0100
committerMatt Caswell <matt@openssl.org>2021-08-24 14:22:06 +0100
commit918430ba80d94ec8f05383b43b1872b1ebb13e1a (patch)
tree44d233320b00964d21452226b9f5783fc74764a5 /crypto/x509/v3_pci.c
parentb2b3b9c9936b91315adc0f3254879cb2fd5ca2bd (diff)
Fix printing of PROXY_CERT_INFO_EXTENSION to not assume NUL terminated strings
ASN.1 strings may not be NUL terminated. Don't assume they are. CVE-2021-3712 Reviewed-by: Viktor Dukhovni <viktor@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: David Benjamin <davidben@google.com>
Diffstat (limited to 'crypto/x509/v3_pci.c')
-rw-r--r--crypto/x509/v3_pci.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/x509/v3_pci.c b/crypto/x509/v3_pci.c
index 7a7c91f776..a931e01a9c 100644
--- a/crypto/x509/v3_pci.c
+++ b/crypto/x509/v3_pci.c
@@ -76,7 +76,8 @@ static int i2r_pci(X509V3_EXT_METHOD *method, PROXY_CERT_INFO_EXTENSION *pci,
BIO_printf(out, "%*sPolicy Language: ", indent, "");
i2a_ASN1_OBJECT(out, pci->proxyPolicy->policyLanguage);
if (pci->proxyPolicy->policy && pci->proxyPolicy->policy->data)
- BIO_printf(out, "\n%*sPolicy Text: %s", indent, "",
+ BIO_printf(out, "\n%*sPolicy Text: %.*s", indent, "",
+ pci->proxyPolicy->policy->length,
pci->proxyPolicy->policy->data);
return 1;
}