diff options
author | Damien Miller <djm@mindrot.org> | 2013-07-18 16:11:25 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2013-07-18 16:11:25 +1000 |
commit | bc35d92e78fd53c3f32cbdbdf89d8b1919788c50 (patch) | |
tree | cc93549f2f5ee87805ac2b8ca0ddd7046823af46 | |
parent | 8158441d01ab84f33a7e70e27f87c02cbf67e709 (diff) |
- djm@cvs.openbsd.org 2013/06/22 06:31:57
[scp.c]
improved time_t overflow check suggested by guenther@
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | scp.c | 8 |
2 files changed, 8 insertions, 3 deletions
@@ -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 | ||
30 | 20130702 | 33 | 20130702 |
31 | - (dtucker) [contrib/cygwin/README contrib/cygwin/ssh-host-config | 34 | - (dtucker) [contrib/cygwin/README contrib/cygwin/ssh-host-config |
@@ -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); |