summaryrefslogtreecommitdiffstats
path: root/crypto/evp
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2021-06-29 08:26:11 +1000
committerPauli <pauli@openssl.org>2021-06-30 13:55:09 +1000
commit5e56f4587de2f2e06c079272fa4d6712d56dbcf0 (patch)
tree5154d77f4240cc46d7bb920cc3bf9c1d59900c60 /crypto/evp
parent98431c431366ec3445e92cf4c50a1d3ac80573a5 (diff)
evp: fix coverity 1473380 Copy into fixed size buffer (STRING_OVERFLOW)
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15943)
Diffstat (limited to 'crypto/evp')
-rw-r--r--crypto/evp/ctrl_params_translate.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/evp/ctrl_params_translate.c b/crypto/evp/ctrl_params_translate.c
index 6998dcc6fc..c532e57f8f 100644
--- a/crypto/evp/ctrl_params_translate.c
+++ b/crypto/evp/ctrl_params_translate.c
@@ -1353,7 +1353,9 @@ static int fix_rsa_pss_saltlen(enum state state,
if (i == OSSL_NELEM(str_value_map)) {
BIO_snprintf(ctx->name_buf, sizeof(ctx->name_buf), "%d", ctx->p1);
} else {
- strcpy(ctx->name_buf, str_value_map[i].ptr);
+ strncpy(ctx->name_buf, str_value_map[i].ptr, sizeof(ctx->name_buf));
+ /* This won't truncate but it will quiet static analysers */
+ ctx->name_buf[sizeof(ctx->name_buf) - 1] = '\0';
}
ctx->p2 = ctx->name_buf;
ctx->p1 = strlen(ctx->p2);