mirror of
https://github.com/openbsd/src.git
synced 2025-01-04 15:25:38 -08:00
there is no offical way to get the max value of time_t, but this one works
on any sensible posix system (in which time_t must be an integer type) ok deraadt@ millert@
This commit is contained in:
parent
e2a49d81ef
commit
76c0e1cfd8
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: cpio.c,v 1.31 2017/09/06 17:24:22 otto Exp $ */
|
||||
/* $OpenBSD: cpio.c,v 1.32 2017/09/12 17:11:11 otto Exp $ */
|
||||
/* $NetBSD: cpio.c,v 1.5 1995/03/21 09:07:13 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
@ -293,7 +293,7 @@ cpio_rd(ARCHD *arcn, char *buf)
|
||||
OCT);
|
||||
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 ((time_t)val < 0 || (time_t)val != val)
|
||||
if (val > MAX_TIME_T)
|
||||
arcn->sb.st_mtime = INT_MAX; /* XXX 2038 */
|
||||
else
|
||||
arcn->sb.st_mtime = val;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: extern.h,v 1.57 2016/08/25 01:44:55 guenther Exp $ */
|
||||
/* $OpenBSD: extern.h,v 1.58 2017/09/12 17:11:11 otto Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.5 1996/03/26 23:54:16 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
@ -268,7 +268,7 @@ int sltab_add_link(const char *, const struct stat *);
|
||||
void sltab_process(int _in_sig);
|
||||
int name_start(void);
|
||||
int add_name(char *, int, char *);
|
||||
void sub_name(char *, int *, size_t);
|
||||
void sub_name(char *, int *, int);
|
||||
#ifndef NOCPIO
|
||||
int dev_start(void);
|
||||
int add_dev(ARCHD *);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: pax.h,v 1.28 2015/11/17 19:01:34 mmcc Exp $ */
|
||||
/* $OpenBSD: pax.h,v 1.29 2017/09/12 17:11:11 otto Exp $ */
|
||||
/* $NetBSD: pax.h,v 1.3 1995/03/21 09:07:41 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
@ -258,3 +258,5 @@ typedef struct oplist {
|
||||
#define OCT 8
|
||||
#define _PAX_ 1
|
||||
#define _TFILE_BASE "paxXXXXXXXXXX"
|
||||
#define MAX_TIME_T (sizeof(time_t) == sizeof(long long) ? \
|
||||
LLONG_MAX : INT_MAX)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: tables.c,v 1.51 2017/03/16 03:53:37 deraadt Exp $ */
|
||||
/* $OpenBSD: tables.c,v 1.52 2017/09/12 17:11:11 otto Exp $ */
|
||||
/* $NetBSD: tables.c,v 1.4 1995/03/21 09:07:45 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
@ -1036,7 +1036,7 @@ add_name(char *oname, int onamelen, char *nname)
|
||||
*/
|
||||
|
||||
void
|
||||
sub_name(char *oname, int *onamelen, size_t onamesize)
|
||||
sub_name(char *oname, int *onamelen, int onamesize)
|
||||
{
|
||||
NAMT *pt;
|
||||
u_int indx;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: tar.c,v 1.64 2017/09/08 12:23:47 otto Exp $ */
|
||||
/* $OpenBSD: tar.c,v 1.65 2017/09/12 17:11:11 otto Exp $ */
|
||||
/* $NetBSD: tar.c,v 1.5 1995/03/21 09:07:49 cgd Exp $ */
|
||||
|
||||
/*-
|
||||
@ -410,7 +410,7 @@ tar_rd(ARCHD *arcn, char *buf)
|
||||
arcn->sb.st_gid = (gid_t)asc_ul(hd->gid, sizeof(hd->gid), OCT);
|
||||
arcn->sb.st_size = (off_t)asc_ull(hd->size, sizeof(hd->size), OCT);
|
||||
val = asc_ull(hd->mtime, sizeof(hd->mtime), OCT);
|
||||
if ((time_t)val < 0 || (time_t)val != val)
|
||||
if (val > MAX_TIME_T)
|
||||
arcn->sb.st_mtime = INT_MAX; /* XXX 2038 */
|
||||
else
|
||||
arcn->sb.st_mtime = val;
|
||||
@ -800,7 +800,7 @@ reset:
|
||||
0xfff);
|
||||
arcn->sb.st_size = (off_t)asc_ull(hd->size, sizeof(hd->size), OCT);
|
||||
val = asc_ull(hd->mtime, sizeof(hd->mtime), OCT);
|
||||
if ((time_t)val < 0 || (time_t)val != val)
|
||||
if (val > MAX_TIME_T)
|
||||
arcn->sb.st_mtime = INT_MAX; /* XXX 2038 */
|
||||
else
|
||||
arcn->sb.st_mtime = val;
|
||||
|
Loading…
Reference in New Issue
Block a user