Replace all sprintf with snprintf

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2023-03-05 22:34:33 +08:00
committed by Alin Jerpelea
parent fa8719bb5a
commit 6f6fce95a2
36 changed files with 120 additions and 84 deletions
@@ -63,7 +63,8 @@ const char *stm32_getchipid_string(void)
for (i = 0, c = 0; i < 12; i++)
{
sprintf(&cpuid[c], "%02X", getreg8(0x1ffff7e8 + 11 - i));
snprintf(&cpuid[c], sizeof(cpuid) - c,
"%02X", getreg8(0x1ffff7e8 + 11 - i));
c += 2;
if (i % 4 == 3)
{
+2 -1
View File
@@ -63,7 +63,8 @@ const char *stm32_getchipid_string(void)
for (i = 0, c = 0; i < 12; i++)
{
sprintf(&cpuid[c], "%02X", getreg8(0x1ffff7e8 + 11 - i));
snprintf(&cpuid[c], sizeof(cpuid) - c,
"%02X", getreg8(0x1ffff7e8 + 11 - i));
c += 2;
if (i % 4 == 3)
{