From c0c5003e080f88521d9e54325e716ca7e17ef9a7 Mon Sep 17 00:00:00 2001 From: tychovrahe Date: Fri, 16 May 2025 17:25:58 +0200 Subject: [PATCH] chore(core): replace itoa with portable function [no changelog] --- core/embed/projects/prodtest/cmd/prodtest_otp_variant.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/embed/projects/prodtest/cmd/prodtest_otp_variant.c b/core/embed/projects/prodtest/cmd/prodtest_otp_variant.c index 349349b363..f491bb7af7 100644 --- a/core/embed/projects/prodtest/cmd/prodtest_otp_variant.c +++ b/core/embed/projects/prodtest/cmd/prodtest_otp_variant.c @@ -17,6 +17,7 @@ * along with this program. If not, see . */ +#include #include #include @@ -25,6 +26,7 @@ #include #include "prodtest_optiga.h" +#include "rtl/mini_printf.h" static void prodtest_otp_variant_read(cli_t* cli) { if (cli_arg_count(cli) > 0) { @@ -52,6 +54,7 @@ static void prodtest_otp_variant_read(cli_t* cli) { cli_trace(cli, "Bytes read: %s", block_hex); char block_text[FLASH_OTP_BLOCK_SIZE * 4 + 1] = {0}; + size_t buffer_size = sizeof(block_text); // Make a list of integers separated by spaces char* dst = block_text; @@ -59,8 +62,9 @@ static void prodtest_otp_variant_read(cli_t* cli) { if (i != 0) { *dst++ = ' '; } - itoa(block[i], dst, 10); + mini_snprintf(dst, buffer_size, "%d", block[i]); dst += strlen(dst); + buffer_size -= strlen(dst); } cli_ok(cli, "%s", block_text);