src: Replace sprintf with snprintf
snprintf is needed anyway, that's one less function to have :p And it's bad practice anyway. Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
parent
1d4152a36f
commit
4289788e0b
|
@ -120,7 +120,7 @@ void gdb_putpacket(const char *packet, int size)
|
|||
}
|
||||
}
|
||||
gdb_if_putchar('#', 0);
|
||||
sprintf(xmit_csum, "%02X", csum);
|
||||
snprintf(xmit_csum, sizeof(xmit_csum), "%02X", csum);
|
||||
gdb_if_putchar(xmit_csum[0], 0);
|
||||
gdb_if_putchar(xmit_csum[1], 1);
|
||||
#ifdef DEBUG_GDBPACKET
|
||||
|
|
|
@ -611,7 +611,7 @@ bool efm32_probe(target *t)
|
|||
uint32_t ram_size = ram_kib * 0x400;
|
||||
uint32_t flash_page_size = device->flash_page_size;
|
||||
|
||||
sprintf(variant_string, "%c\b%c\b%s %d F%d %s",
|
||||
snprintf(variant_string, sizeof(variant_string), "%c\b%c\b%s %d F%d %s",
|
||||
di_version + 48, (uint8_t)device_index + 32,
|
||||
device->name, part_number, flash_kib, device->description);
|
||||
|
||||
|
|
|
@ -390,15 +390,15 @@ bool samd_probe(target *t)
|
|||
|
||||
/* Part String */
|
||||
if (protected) {
|
||||
sprintf(variant_string,
|
||||
"Atmel SAMD%d%c%dA%s (rev %c) (PROT=1)",
|
||||
samd.series, samd.pin, samd.mem,
|
||||
samd.package, samd.revision);
|
||||
snprintf(variant_string, sizeof(variant_string),
|
||||
"Atmel SAMD%d%c%dA%s (rev %c) (PROT=1)",
|
||||
samd.series, samd.pin, samd.mem,
|
||||
samd.package, samd.revision);
|
||||
} else {
|
||||
sprintf(variant_string,
|
||||
"Atmel SAMD%d%c%dA%s (rev %c)",
|
||||
samd.series, samd.pin, samd.mem,
|
||||
samd.package, samd.revision);
|
||||
snprintf(variant_string, sizeof(variant_string),
|
||||
"Atmel SAMD%d%c%dA%s (rev %c)",
|
||||
samd.series, samd.pin, samd.mem,
|
||||
samd.package, samd.revision);
|
||||
}
|
||||
|
||||
/* Setup Target */
|
||||
|
|
Loading…
Reference in New Issue