Skip to content

Commit

Permalink
cpio: do not call strftime() with NULL timeptr
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatuska committed Jul 25, 2023
1 parent 3cfae35 commit 2bc4ba9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cpio/cpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,10 @@ list_item_verbose(struct cpio *cpio, struct archive_entry *entry)
#else
ltime = localtime(&mtime);
#endif
strftime(date, sizeof(date), fmt, ltime);
if (ltime != NULL)
strftime(date, sizeof(date), fmt, ltime);
else
strcpy(date, "invalid mtime");

fprintf(out, "%s%3d %-8s %-8s %8s %12s %s",
archive_entry_strmode(entry),
Expand Down

0 comments on commit 2bc4ba9

Please sign in to comment.