From: Richard Levitte Date: Tue, 23 Feb 2021 07:10:02 +0000 (+0100) Subject: Fix OSSL_PARAM_allocate_from_text() for OSSL_PARAM_UTF8_STRING X-Git-Tag: openssl-3.0.0-alpha13~190 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=af8bd1d8359705c6a980c65b0c27c3e90fc43bea;p=thirdparty%2Fopenssl.git 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 (Merged from https://github.com/openssl/openssl/pull/14035) --- diff --git a/crypto/params_from_text.c b/crypto/params_from_text.c index b019744f9b7..3ff94c7475f 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) {