to avoid use of undefined content of buf, in case when custom
locale makes the result string longer than buf length.
Signed-off-by: Marcin Mikula <marcin@helix.pl>
{
char tmp[100];
size_t w;
+ size_t sw;
const char *p;
const char *fmt;
time_t tim;
ltime = localtime(&tim);
#endif
if (ltime)
- strftime(tmp, sizeof(tmp), fmt, ltime);
- else
+ sw = strftime(tmp, sizeof(tmp), fmt, ltime);
+ if (!ltime || !sw)
sprintf(tmp, "-- -- ----");
fprintf(out, " %s ", tmp);
safe_fprintf(out, "%s", archive_entry_pathname(entry));