summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordtucker <dtucker@openbsd.org>2017-03-14 00:55:37 +0000
committerdtucker <dtucker@openbsd.org>2017-03-14 00:55:37 +0000
commit9e444c7b9315528246391847d27f06f18246d3ad (patch)
tree327c4822cbee9e4d444d1e2d2e80c6b3ef307467
parentCheck for integer overflow when parsing times in convtime(). Reported by (diff)
downloadwireguard-openbsd-9e444c7b9315528246391847d27f06f18246d3ad.tar.xz
wireguard-openbsd-9e444c7b9315528246391847d27f06f18246d3ad.zip
Fix convtime() overflow test on boundary condition, spotted by & ok djm.
-rw-r--r--usr.bin/ssh/misc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/ssh/misc.c b/usr.bin/ssh/misc.c
index ba9465718e5..17fdcc66750 100644
--- a/usr.bin/ssh/misc.c
+++ b/usr.bin/ssh/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.108 2017/03/14 00:25:03 dtucker Exp $ */
+/* $OpenBSD: misc.c,v 1.109 2017/03/14 00:55:37 dtucker Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005,2006 Damien Miller. All rights reserved.
@@ -333,10 +333,10 @@ convtime(const char *s)
default:
return -1;
}
- if (secs > LONG_MAX / multiplier)
+ if (secs >= LONG_MAX / multiplier)
return -1;
secs *= multiplier;
- if (total > LONG_MAX - secs)
+ if (total >= LONG_MAX - secs)
return -1;
total += secs;
if (total < 0)