[openssh-commits] [openssh] 02/03: Import fmt_scaled.c rev 1.15 from OpenBSD.

git+noreply at mindrot.org git+noreply at mindrot.org
Wed Mar 29 16:35:52 AEDT 2017


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit c73a229e4edf98920f395e19fd310684fc6bb951
Author: Darren Tucker <dtucker at zip.com.au>
Date:   Wed Mar 29 16:34:02 2017 +1100

    Import fmt_scaled.c rev 1.15 from OpenBSD.
    
    Collapse underflow and overflow checks into a single block.
    ok djm@ millert@
---
 openbsd-compat/fmt_scaled.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/openbsd-compat/fmt_scaled.c b/openbsd-compat/fmt_scaled.c
index 7e6a57d..8af8660 100644
--- a/openbsd-compat/fmt_scaled.c
+++ b/openbsd-compat/fmt_scaled.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: fmt_scaled.c,v 1.14 2017/03/15 00:13:18 dtucker Exp $	*/
+/*	$OpenBSD: fmt_scaled.c,v 1.15 2017/03/15 05:25:56 dtucker Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003 Ian F. Darwin.  All rights reserved.
@@ -170,12 +170,9 @@ scan_scaled(char *scaled, long long *result)
 			}
 			scale_fact = scale_factors[i];
 
-			if (whole >= LLONG_MAX / scale_fact) {
-				errno = ERANGE;
-				return -1;
-			}
-
-			if (whole <= LLONG_MIN / scale_fact) {
+			/* check for overflow and underflow after scaling */
+			if (whole > LLONG_MAX / scale_fact ||
+			    whole < LLONG_MIN / scale_fact) {
 				errno = ERANGE;
 				return -1;
 			}

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list