Fix printing of PROXY_CERT_INFO_EXTENSION to not assume NUL terminated strings
[openssl.git] / crypto / x509 / v3_pci.c
index 7a7c91f776ee7f1b1a67f3826c1192d688e78319..a931e01a9c92f3761a4d4d43365070b6f40e0b9f 100644 (file)
@@ -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;
 }