From: Dr. David von Oheimb Date: Fri, 20 Mar 2020 14:15:34 +0000 (+0100) Subject: Fix bug in strncpy() use of sk_ASN1_UTF8STRING2text() in asn1_lib.c X-Git-Tag: openssl-3.0.0-alpha1~215 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b4ba2b7ce0933bede5d3b59a5abbde8fa3de2228;p=oweals%2Fopenssl.git Fix bug in strncpy() use of sk_ASN1_UTF8STRING2text() in asn1_lib.c Reviewed-by: Matt Caswell Reviewed-by: David von Oheimb (Merged from https://github.com/openssl/openssl/pull/11300) --- diff --git a/crypto/asn1/asn1_lib.c b/crypto/asn1/asn1_lib.c index 765bbda5c7..fc4462eb8f 100644 --- a/crypto/asn1/asn1_lib.c +++ b/crypto/asn1/asn1_lib.c @@ -426,7 +426,7 @@ char *sk_ASN1_UTF8STRING2text(STACK_OF(ASN1_UTF8STRING) *text, const char *sep, current = sk_ASN1_UTF8STRING_value(text, i); length = ASN1_STRING_length(current); if (i > 0 && sep_len > 0) { - strncpy(p, sep, sep_len); + strncpy(p, sep, sep_len + 1); p += sep_len; } strncpy(p, (const char *)ASN1_STRING_get0_data(current), length);