Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15943)
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);