diff --git a/sim_fio.c b/sim_fio.c index b600b914..d0b48368 100644 --- a/sim_fio.c +++ b/sim_fio.c @@ -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++) {