aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2025-11-17 18:24:39 -0500
committerB. Watson <urchlay@slackware.uk>2025-11-17 18:24:39 -0500
commit409ec782e1a74cbd86b6e51b49c0785021be0fdc (patch)
tree2c93034595a6fca137aa7adfebbd69fd684e1f4e
parentcfec6c2c31abd9f56d4cbb5fe9c3463055226244 (diff)
downloadunalf-409ec782e1a74cbd86b6e51b49c0785021be0fdc.tar.gz
Use snprintf(), not sprintf().
-rw-r--r--src/listalf.c4
1 files 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