diff options
author | dtucker@openbsd.org <dtucker@openbsd.org> | 2017-03-14 00:55:37 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2017-03-14 13:45:14 +1100 |
commit | c6774d21185220c0ba11e8fd204bf0ad1a432071 (patch) | |
tree | 449404583a79f9e6a156e796159d0af1e686a11e /misc.c | |
parent | f5746b40cfe6d767c8e128fe50c43274b31cd594 (diff) |
upstream commit
Fix convtime() overflow test on boundary condition,
spotted by & ok djm.
Upstream-ID: 51f14c507ea87a3022e63f574100613ab2ba5708
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: misc.c,v 1.108 2017/03/14 00:25:03 dtucker Exp $ */ | 1 | /* $OpenBSD: misc.c,v 1.109 2017/03/14 00:55:37 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2005,2006 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2005,2006 Damien Miller. All rights reserved. |
@@ -350,10 +350,10 @@ convtime(const char *s) | |||
350 | default: | 350 | default: |
351 | return -1; | 351 | return -1; |
352 | } | 352 | } |
353 | if (secs > LONG_MAX / multiplier) | 353 | if (secs >= LONG_MAX / multiplier) |
354 | return -1; | 354 | return -1; |
355 | secs *= multiplier; | 355 | secs *= multiplier; |
356 | if (total > LONG_MAX - secs) | 356 | if (total >= LONG_MAX - secs) |
357 | return -1; | 357 | return -1; |
358 | total += secs; | 358 | total += secs; |
359 | if (total < 0) | 359 | if (total < 0) |