From 3c973a643104315ed1cb6c73fa9aef237775404f Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Thu, 25 Sep 2003 04:16:42 +0000 Subject: do not crank size before erealloc --- sbin/fsck/fsck.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sbin') diff --git a/sbin/fsck/fsck.c b/sbin/fsck/fsck.c index 8e31797f2be..cf7e9889ed7 100644 --- a/sbin/fsck/fsck.c +++ b/sbin/fsck/fsck.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fsck.c,v 1.15 2003/07/29 20:26:23 millert Exp $ */ +/* $OpenBSD: fsck.c,v 1.16 2003/09/25 04:16:41 deraadt Exp $ */ /* $NetBSD: fsck.c,v 1.7 1996/10/03 20:06:30 christos Exp $ */ /* @@ -35,7 +35,7 @@ * */ -static const char rcsid[] = "$OpenBSD: fsck.c,v 1.15 2003/07/29 20:26:23 millert Exp $"; +static const char rcsid[] = "$OpenBSD: fsck.c,v 1.16 2003/09/25 04:16:41 deraadt Exp $"; #include #include @@ -433,8 +433,10 @@ mangle(char *opts, int *argcp, const char ***argvp, int *maxargcp) for (s = opts; (p = strsep(&s, ",")) != NULL;) { /* always leave space for one more argument and the NULL */ if (argc >= maxargc - 3) { - maxargc += 50; - argv = erealloc(argv, maxargc * sizeof(char *)); + int newmaxargc = maxargc + 50; + + argv = erealloc(argv, newmaxargc * sizeof(char *)); + maxargc == newmaxargc; } if (*p != '\0') { if (*p == '-') { -- cgit v1.2.3