summaryrefslogtreecommitdiff
path: root/crypto/params_from_text.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2021-02-23 08:10:02 +0100
committerRichard Levitte <levitte@openssl.org>2021-02-24 19:50:10 +0100
commitaf8bd1d8359705c6a980c65b0c27c3e90fc43bea (patch)
tree9f99d4a68a7b986aa7a996978378d17fad967c7f /crypto/params_from_text.c
parenta8eb71ad577bbbd41cea915315451f0ef9f11581 (diff)
downloadopenssl-new-af8bd1d8359705c6a980c65b0c27c3e90fc43bea.tar.gz
Fix OSSL_PARAM_allocate_from_text() for OSSL_PARAM_UTF8_STRING
OSSL_PARAM_allocate_from_text() was still setting the length in bytes of the UTF8 string to include the terminating NUL byte, while recent changes excludes that byte from the length. Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14035)
Diffstat (limited to 'crypto/params_from_text.c')
-rw-r--r--crypto/params_from_text.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/params_from_text.c b/crypto/params_from_text.c
index b019744f9b..3ff94c7475 100644
--- a/crypto/params_from_text.c
+++ b/crypto/params_from_text.c
@@ -151,6 +151,8 @@ static int construct_from_text(OSSL_PARAM *to, const OSSL_PARAM *paramdef,
#else
strncpy(buf, value, buf_n);
#endif
+ /* Don't count the terminating NUL byte as data */
+ buf_n--;
break;
case OSSL_PARAM_OCTET_STRING:
if (ishex) {