aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorBob Beck <[email protected]>2026-08-05 23:54:01 +0200
committerTomas Mraz <[email protected]>2026-08-27 15:52:18 +0200
commit4f183765aab81df08aa53baf483b26d02ad677bb (patch)
tree5e6025123ea505a083f37edda5c71df4605ea203 /apps
parentDon't hit the legacy strlen case in ASN1_STRING_copy (diff)
downloadopenssl-4f183765aab81df08aa53baf483b26d02ad677bb.tar.gz
openssl-4f183765aab81df08aa53baf483b26d02ad677bb.zip
Sweep for printf UB - don't printf %s NULL
As an asn1_string of length 0 will have NULL data, don't printf %s NULL. Reviewed-by: Neil Horman <[email protected]> Reviewed-by: Andrew Dinh <[email protected]> Reviewed-by: Nikola Pajkovsky <[email protected]> Merge-date: Thu Aug 27 13:52:48 2026 Merged-from: https://github.com/openssl/openssl/pull/32178
Diffstat (limited to 'apps')
-rw-r--r--apps/pkcs12.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/apps/pkcs12.c b/apps/pkcs12.c
index 7c2c77d4ffb..2deb87a1f87 100644
--- a/apps/pkcs12.c
+++ b/apps/pkcs12.c
@@ -1289,7 +1289,9 @@ void print_attribute(BIO *out, const ASN1_TYPE *av)
case V_ASN1_UTF8STRING:
BIO_printf(out, "%.*s\n", (int)ASN1_STRING_get_length(av->value.utf8string),
- ASN1_STRING_get0_data(av->value.utf8string));
+ ASN1_STRING_get_length(av->value.utf8string)
+ ? ASN1_STRING_get0_data(av->value.utf8string)
+ : (const unsigned char *)"");
break;
case V_ASN1_OCTET_STRING: