- djm@cvs.openbsd.org 2013/06/22 06:31:57

[scp.c]
     improved time_t overflow check suggested by guenther@
This commit is contained in:
Damien Miller 2013-07-18 16:11:25 +10:00
parent 8158441d01
commit bc35d92e78
2 changed files with 8 additions and 3 deletions

View File

@ -26,6 +26,9 @@
- djm@cvs.openbsd.org 2013/06/21 05:43:10
[scp.c]
make this -Wsign-compare clean after time_t conversion
- djm@cvs.openbsd.org 2013/06/22 06:31:57
[scp.c]
improved time_t overflow check suggested by guenther@
20130702
- (dtucker) [contrib/cygwin/README contrib/cygwin/ssh-host-config

8
scp.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: scp.c,v 1.177 2013/06/21 05:43:10 djm Exp $ */
/* $OpenBSD: scp.c,v 1.178 2013/06/22 06:31:57 djm Exp $ */
/*
* scp - secure remote copy. This is basically patched BSD rcp which
* uses ssh to do the data transfer (instead of using rcmd).
@ -976,7 +976,8 @@ sink(int argc, char **argv)
ull = strtoull(cp, &cp, 10);
if (!cp || *cp++ != ' ')
SCREWUP("mtime.sec not delimited");
if ((time_t)ull < 0 || ull > LLONG_MAX)
if ((time_t)ull < 0 ||
(unsigned long long)(time_t)ull != ull)
setimes = 0; /* out of range */
mtime.tv_sec = ull;
mtime.tv_usec = strtol(cp, &cp, 10);
@ -988,7 +989,8 @@ sink(int argc, char **argv)
ull = strtoull(cp, &cp, 10);
if (!cp || *cp++ != ' ')
SCREWUP("atime.sec not delimited");
if ((time_t)ull < 0 || ull > LLONG_MAX)
if ((time_t)ull < 0 ||
(unsigned long long)(time_t)ull != ull)
setimes = 0; /* out of range */
atime.tv_sec = ull;
atime.tv_usec = strtol(cp, &cp, 10);