From 5054a6b601574f7beb0f78bf7c50d664c97aad4c Mon Sep 17 00:00:00 2001 From: Andrei Pangin Date: Wed, 11 Dec 2024 01:39:44 +0000 Subject: [PATCH] Fixed compiler warning about sprintf --- src/rustDemangle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rustDemangle.cpp b/src/rustDemangle.cpp index 217fe475b..e9d97dd1a 100644 --- a/src/rustDemangle.cpp +++ b/src/rustDemangle.cpp @@ -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); } @@ -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, "]"); }