summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2013-07-18 16:11:25 +1000
committerDamien Miller <djm@mindrot.org>2013-07-18 16:11:25 +1000
commitbc35d92e78fd53c3f32cbdbdf89d8b1919788c50 (patch)
treecc93549f2f5ee87805ac2b8ca0ddd7046823af46
parent8158441d01ab84f33a7e70e27f87c02cbf67e709 (diff)
- djm@cvs.openbsd.org 2013/06/22 06:31:57
[scp.c] improved time_t overflow check suggested by guenther@
-rw-r--r--ChangeLog3
-rw-r--r--scp.c8
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 86da2761c..1502ec873 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -26,6 +26,9 @@
26 - djm@cvs.openbsd.org 2013/06/21 05:43:10 26 - djm@cvs.openbsd.org 2013/06/21 05:43:10
27 [scp.c] 27 [scp.c]
28 make this -Wsign-compare clean after time_t conversion 28 make this -Wsign-compare clean after time_t conversion
29 - djm@cvs.openbsd.org 2013/06/22 06:31:57
30 [scp.c]
31 improved time_t overflow check suggested by guenther@
29 32
3020130702 3320130702
31 - (dtucker) [contrib/cygwin/README contrib/cygwin/ssh-host-config 34 - (dtucker) [contrib/cygwin/README contrib/cygwin/ssh-host-config
diff --git a/scp.c b/scp.c
index 958faf3fc..28ded5e9a 100644
--- a/scp.c
+++ b/scp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: scp.c,v 1.177 2013/06/21 05:43:10 djm Exp $ */ 1/* $OpenBSD: scp.c,v 1.178 2013/06/22 06:31:57 djm Exp $ */
2/* 2/*
3 * scp - secure remote copy. This is basically patched BSD rcp which 3 * scp - secure remote copy. This is basically patched BSD rcp which
4 * uses ssh to do the data transfer (instead of using rcmd). 4 * uses ssh to do the data transfer (instead of using rcmd).
@@ -976,7 +976,8 @@ sink(int argc, char **argv)
976 ull = strtoull(cp, &cp, 10); 976 ull = strtoull(cp, &cp, 10);
977 if (!cp || *cp++ != ' ') 977 if (!cp || *cp++ != ' ')
978 SCREWUP("mtime.sec not delimited"); 978 SCREWUP("mtime.sec not delimited");
979 if ((time_t)ull < 0 || ull > LLONG_MAX) 979 if ((time_t)ull < 0 ||
980 (unsigned long long)(time_t)ull != ull)
980 setimes = 0; /* out of range */ 981 setimes = 0; /* out of range */
981 mtime.tv_sec = ull; 982 mtime.tv_sec = ull;
982 mtime.tv_usec = strtol(cp, &cp, 10); 983 mtime.tv_usec = strtol(cp, &cp, 10);
@@ -988,7 +989,8 @@ sink(int argc, char **argv)
988 ull = strtoull(cp, &cp, 10); 989 ull = strtoull(cp, &cp, 10);
989 if (!cp || *cp++ != ' ') 990 if (!cp || *cp++ != ' ')
990 SCREWUP("atime.sec not delimited"); 991 SCREWUP("atime.sec not delimited");
991 if ((time_t)ull < 0 || ull > LLONG_MAX) 992 if ((time_t)ull < 0 ||
993 (unsigned long long)(time_t)ull != ull)
992 setimes = 0; /* out of range */ 994 setimes = 0; /* out of range */
993 atime.tv_sec = ull; 995 atime.tv_sec = ull;
994 atime.tv_usec = strtol(cp, &cp, 10); 996 atime.tv_usec = strtol(cp, &cp, 10);