1
0
mirror of https://github.com/simh/simh.git synced 2026-01-25 19:56:25 +00:00

FIO: Avoid potential buffer overrun while formatting file modify time

Silence over aggressive compiler warning.
This commit is contained in:
Mark Pizzolato
2023-01-16 16:56:26 -10:00
parent 88c6f7847f
commit a1172690a0

View File

@@ -1474,7 +1474,7 @@ char *c, *name, *ext;
char chr;
const char *p;
char filesizebuf[32] = "";
char filedatetimebuf[32] = "";
char filedatetimebuf[64] = "";
char namebuf[PATH_MAX + 1];
@@ -1553,7 +1553,7 @@ if (strchr (parts, 't') || /* modification time or */
else
sprintf (filesizebuf, "%" LL_FMT "d ", (LL_TYPE)filestat.st_size);
tm = localtime (&filestat.st_mtime);
sprintf (filedatetimebuf, "%02d/%02d/%04d %02d:%02d %cM ", 1 + tm->tm_mon, tm->tm_mday, 1900 + tm->tm_year,
snprintf (filedatetimebuf, sizeof (filedatetimebuf), "%02d/%02d/%04d %02d:%02d %cM ", 1 + tm->tm_mon, tm->tm_mday, 1900 + tm->tm_year,
tm->tm_hour % 12, tm->tm_min, (0 == (tm->tm_hour % 12)) ? 'A' : 'P');
}
for (p = parts; *p; p++) {