summaryrefslogtreecommitdiffstats
path: root/crypto/params.c
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2019-09-04 19:27:08 +1000
committerPauli <paul.dale@oracle.com>2019-09-04 19:41:22 +1000
commit7f588d20cd9ed2bb0ee2577a4523453964f532b0 (patch)
tree02b81ea1b5152c87e1b0ebe802dc2581df6fcfa5 /crypto/params.c
parent550f974a09942ace37cf3cf14021ea5e51e6dd11 (diff)
OSSL_PARAM_construct_utf8_string computes the string length.
If the passed string length is zero, the function computes the string length from the passed string. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9760)
Diffstat (limited to 'crypto/params.c')
-rw-r--r--crypto/params.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/params.c b/crypto/params.c
index b3fbb12b9b..20082ad90b 100644
--- a/crypto/params.c
+++ b/crypto/params.c
@@ -808,6 +808,8 @@ int OSSL_PARAM_set_octet_string(OSSL_PARAM *p, const void *val,
OSSL_PARAM OSSL_PARAM_construct_utf8_string(const char *key, char *buf,
size_t bsize)
{
+ if (buf != NULL && bsize == 0)
+ bsize = strlen(buf) + 1;
return ossl_param_construct(key, OSSL_PARAM_UTF8_STRING, buf, bsize);
}