mirror of
https://github.com/openbsd/src.git
synced 2025-01-04 15:25:38 -08:00
pax: truncate times to MAX_TIME_T, not INT_MAX
If the mtime in the file header is larger than MAX_TIME_T, trucate it to MAX_TIME_T, not INT_MAX. OK otto@
This commit is contained in:
parent
375ccafb2e
commit
2f186deaaa
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: cpio.c,v 1.33 2017/09/16 07:42:34 otto Exp $ */
|
||||
/* $OpenBSD: cpio.c,v 1.34 2023/06/26 18:00:59 millert Exp $ */
|
||||
/* $NetBSD: cpio.c,v 1.5 1995/03/21 09:07:13 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
@ -294,7 +294,7 @@ cpio_rd(ARCHD *arcn, char *buf)
|
||||
arcn->sb.st_rdev = (dev_t)asc_ul(hd->c_rdev, sizeof(hd->c_rdev), OCT);
|
||||
val = asc_ull(hd->c_mtime, sizeof(hd->c_mtime), OCT);
|
||||
if (val > MAX_TIME_T)
|
||||
arcn->sb.st_mtime = INT_MAX; /* XXX 2038 */
|
||||
arcn->sb.st_mtime = MAX_TIME_T;
|
||||
else
|
||||
arcn->sb.st_mtime = val;
|
||||
arcn->sb.st_mtim.tv_nsec = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: tar.c,v 1.70 2022/03/01 21:19:11 sthen Exp $ */
|
||||
/* $OpenBSD: tar.c,v 1.71 2023/06/26 18:00:59 millert Exp $ */
|
||||
/* $NetBSD: tar.c,v 1.5 1995/03/21 09:07:49 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
@ -411,7 +411,7 @@ tar_rd(ARCHD *arcn, char *buf)
|
||||
arcn->sb.st_size = (off_t)asc_ull(hd->size, sizeof(hd->size), OCT);
|
||||
val = asc_ull(hd->mtime, sizeof(hd->mtime), OCT);
|
||||
if (val > MAX_TIME_T)
|
||||
arcn->sb.st_mtime = INT_MAX; /* XXX 2038 */
|
||||
arcn->sb.st_mtime = MAX_TIME_T;
|
||||
else
|
||||
arcn->sb.st_mtime = val;
|
||||
arcn->sb.st_ctime = arcn->sb.st_atime = arcn->sb.st_mtime;
|
||||
@ -788,7 +788,7 @@ reset:
|
||||
if (arcn->sb.st_mtime == 0) {
|
||||
val = asc_ull(hd->mtime, sizeof(hd->mtime), OCT);
|
||||
if (val > MAX_TIME_T)
|
||||
arcn->sb.st_mtime = INT_MAX; /* XXX 2038 */
|
||||
arcn->sb.st_mtime = MAX_TIME_T;
|
||||
else
|
||||
arcn->sb.st_mtime = val;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user