From 409ec782e1a74cbd86b6e51b49c0785021be0fdc Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Mon, 17 Nov 2025 18:24:39 -0500 Subject: Use snprintf(), not sprintf(). --- src/listalf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/listalf.c b/src/listalf.c index 2a06620..e94b95a 100644 --- a/src/listalf.c +++ b/src/listalf.c @@ -41,7 +41,7 @@ void format_msdos_time(char *buf) { /* midnight and noon print as 12, not 0 */ if(hour == 0) hour = 12; - sprintf(buf, "%2d:%02d%c", hour, min, ampm); + snprintf(buf, 7, "%2d:%02d%c", hour, min, ampm); } /* see Arcinfo for details */ @@ -61,7 +61,7 @@ void format_msdos_date(char *buf) { /* valid day range is 1 to 31. 0 is invalid, print as-is. */ day = d & 0x1f; - sprintf(buf, "%2d %3s %02d", day, monthnames[month], year); + snprintf(buf, 10, "%2d %3s %02d", day, monthnames[month], year); } /* small files may be "compressed" larger than the original, so this -- cgit v1.2.3