diff options
author | Damien Miller <djm@mindrot.org> | 2013-07-18 08:11:25 +0200 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2013-07-18 08:11:25 +0200 |
commit | bc35d92e78fd53c3f32cbdbdf89d8b1919788c50 (patch) | |
tree | cc93549f2f5ee87805ac2b8ca0ddd7046823af46 /scp.c | |
parent | - djm@cvs.openbsd.org 2013/06/21 05:43:10 (diff) | |
download | openssh-bc35d92e78fd53c3f32cbdbdf89d8b1919788c50.tar.xz openssh-bc35d92e78fd53c3f32cbdbdf89d8b1919788c50.zip |
- djm@cvs.openbsd.org 2013/06/22 06:31:57
[scp.c]
improved time_t overflow check suggested by guenther@
Diffstat (limited to 'scp.c')
-rw-r--r-- | scp.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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); |