diff options
Diffstat (limited to 'crypto/params.c')
-rw-r--r-- | crypto/params.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/params.c b/crypto/params.c index 50e900a406..d9743633b0 100644 --- a/crypto/params.c +++ b/crypto/params.c @@ -1128,11 +1128,13 @@ int OSSL_PARAM_get_utf8_string(const OSSL_PARAM *p, char **val, size_t max_len) */ size_t data_length = p->data_size; + if (ret == 0) + return 0; if (data_length >= max_len) data_length = OPENSSL_strnlen(p->data, data_length); if (data_length >= max_len) return 0; /* No space for a terminating NUL byte */ - ((char *)*val)[data_length] = '\0'; + (*val)[data_length] = '\0'; return ret; } |