diff --git a/src/gdb_packet.c b/src/gdb_packet.c index f738996..0396e0d 100644 --- a/src/gdb_packet.c +++ b/src/gdb_packet.c @@ -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 diff --git a/src/target/efm32.c b/src/target/efm32.c index fff186b..4405d99 100644 --- a/src/target/efm32.c +++ b/src/target/efm32.c @@ -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); diff --git a/src/target/samd.c b/src/target/samd.c index 13e97fd..3117f2a 100644 --- a/src/target/samd.c +++ b/src/target/samd.c @@ -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 */