Commit 5373a68230 for openssl.org
commit 5373a68230fa5fa7f3a7a22d8647377c71d934fa
Author: Eugene Syromiatnikov <esyr@openssl.org>
Date: Wed Sep 23 03:25:26 2026 +0200
doc/man3/ASN1_STRING_length.pod: explicitly document the addition of NUL bytes
Add mentions whether NUL bytes are appended to ASN1_STRING_set(),
ASN1_STRING_set1_data(), and ASN1_STRING_set1_string() descriptions.
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Merge-date: Tue Nov 10 15:07:01 2026
Merged-from: https://github.com/openssl/openssl/pull/32937
diff --git a/doc/man3/ASN1_STRING_length.pod b/doc/man3/ASN1_STRING_length.pod
index 9bce95060b..9a23e92198 100644
--- a/doc/man3/ASN1_STRING_length.pod
+++ b/doc/man3/ASN1_STRING_length.pod
@@ -82,14 +82,18 @@ are identical. The string types and content are compared.
ASN1_STRING_set() allocates memory for string I<str> to hold I<len>
bytes of data. Any previously allocated memory owned by I<str> will be
freed or re-used. If I<data> is not NULL, I<len> bytes are copied
-from the memory pointed to by I<data> to I<str>. If I<len> is -1 then
-the length is determined by strlen(data).
+from the memory pointed to by I<data> to I<str>. If I<len> is -1,
+then the length is determined by strlen(data).
+As a historic implementation detail, ASN1_STRING_set() appends a NUL byte
+after the data copied into I<str>, so this function is deprecated.
ASN1_STRING_set1_data() allocates memory for string I<str> to hold
I<len> bytes of data. Any previously allocated memory owned by I<str>
will be freed or re-used. If I<data> is not NULL, I<len> bytes are
copied from the memory pointed to by I<data> to I<str>. It is an error
to use this function on a string of type B<ASN1_BIT_STRING>.
+Unlike ASN1_STRING_set(), ASN1_STRING_set1_data() does not append a NUL
+byte to the data copied into I<str>.
ASN1_STRING_set1_string() allocates memory for the string I<str> and makes
a copy of the characters from I<cstring>. Any previously
@@ -97,7 +101,8 @@ allocated memory owned by I<str> will be freed or re-used. I<cstring>
must point to a valid NUL-terminated C string, and must not be
NULL. The terminating NUL byte is not included in the data copied into
I<str>. It is an error to use this function on a string of type
-B<ASN1_BIT_STRING>.
+B<ASN1_BIT_STRING>. ASN1_STRING_set1_string() does not append a NUL
+byte to the data copied into I<str>.
ASN1_STRING_set0() sets the content of the string I<str> to I<data>
of I<len> bytes in size; the ownership of I<data> is assumed