summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2015-02-06 08:53:02 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2015-02-06 08:53:02 +0000
commitd17919ba1c2db29af84edc86081481e7f698ac41 (patch)
treefcdf5cdfb630412802cb59109c42bb1a6ab6f3ec /usr.bin
parentcaeed083e3f4b7b813bbc38b9ba937974a32a4e1 (diff)
fix an integer overflow found by mlarkin
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/fold/fold.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/fold/fold.c b/usr.bin/fold/fold.c
index bba27d1f3d9..0b42829685f 100644
--- a/usr.bin/fold/fold.c
+++ b/usr.bin/fold/fold.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fold.c,v 1.13 2010/10/22 14:11:22 millert Exp $ */
+/* $OpenBSD: fold.c,v 1.14 2015/02/06 08:53:01 tedu Exp $ */
/* $NetBSD: fold.c,v 1.6 1995/09/01 01:42:44 jtc Exp $ */
/*-
@@ -79,7 +79,7 @@ main(int argc, char *argv[])
width = 0;
else if (!isdigit(lastch))
usage();
- if (width > INT_MAX / 10)
+ if (width > INT_MAX / 10 - 1)
errx(1, "illegal width value, too large");
width = (width * 10) + (ch - '0');
if (width < 1)