diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | scp.c | 8 |
2 files changed, 8 insertions, 3 deletions
@@ -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 @@ -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); |