summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--openbsd-compat/fmt_scaled.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/openbsd-compat/fmt_scaled.c b/openbsd-compat/fmt_scaled.c
index e5533b2de..7e6a57d45 100644
--- a/openbsd-compat/fmt_scaled.c
+++ b/openbsd-compat/fmt_scaled.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: fmt_scaled.c,v 1.13 2017/03/11 23:37:23 djm Exp $ */ 1/* $OpenBSD: fmt_scaled.c,v 1.14 2017/03/15 00:13:18 dtucker Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001, 2002, 2003 Ian F. Darwin. All rights reserved. 4 * Copyright (c) 2001, 2002, 2003 Ian F. Darwin. All rights reserved.
@@ -175,6 +175,11 @@ scan_scaled(char *scaled, long long *result)
175 return -1; 175 return -1;
176 } 176 }
177 177
178 if (whole <= LLONG_MIN / scale_fact) {
179 errno = ERANGE;
180 return -1;
181 }
182
178 /* scale whole part */ 183 /* scale whole part */
179 whole *= scale_fact; 184 whole *= scale_fact;
180 185