Skip to content

Commit

Permalink
Fixed compiler warning about sprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
apangin committed Dec 11, 2024
1 parent f0ceda6 commit 5054a6b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rustDemangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ static NODISCARD overflow_status printer_print_ch(struct printer *printer, char

static NODISCARD overflow_status printer_print_u64(struct printer *printer, uint64_t n) {
char buf[32] = {0};
sprintf(buf, "%llu", (unsigned long long)n); // printing uint64 uses 21 < 32 chars
snprintf(buf, sizeof(buf), "%llu", (unsigned long long)n); // printing uint64 uses 21 < 32 chars
return printer_print_str(printer, buf);
}

Expand Down Expand Up @@ -1172,7 +1172,7 @@ static NODISCARD overflow_status printer_print_path(struct printer *printer, boo
if (printer->out != NULL && !printer->alternate && dis != 0) {
PRINT_STR(printer, "[");
char buf[24] = {0};
sprintf(buf, "%llx", (unsigned long long)dis);
snprintf(buf, sizeof(buf), "%llx", (unsigned long long)dis);
PRINT_STR(printer, buf);
PRINT_STR(printer, "]");
}
Expand Down

0 comments on commit 5054a6b

Please sign in to comment.