apps/pkcs12: Do not assume null termination of ASN1_UTF8STRING
[openssl.git] / apps / pkcs12.c
index d745df84943b0ec25d02bae116c2e86952155a2e..dcb173f201f3c3c8fb237827a6c8739c57ff7676 100644 (file)
@@ -1142,7 +1142,8 @@ void print_attribute(BIO *out, const ASN1_TYPE *av)
         break;
 
     case V_ASN1_UTF8STRING:
-        BIO_printf(out, "%s\n", av->value.utf8string->data);
+        BIO_printf(out, "%.*s\n", av->value.utf8string->length,
+                   av->value.utf8string->data);
         break;
 
     case V_ASN1_OCTET_STRING: