diff options
author | 2003-09-25 04:16:41 +0000 | |
---|---|---|
committer | 2003-09-25 04:16:41 +0000 | |
commit | 4b05fed43d726123a142b92676d6351d0f2e7a8a (patch) | |
tree | 235a16703988ba36456f7f9ebde22643ea60df4d | |
parent | p = realloc(p is not allowed (diff) | |
download | wireguard-openbsd-4b05fed43d726123a142b92676d6351d0f2e7a8a.tar.xz wireguard-openbsd-4b05fed43d726123a142b92676d6351d0f2e7a8a.zip |
do not crank size before erealloc
-rw-r--r-- | sbin/fsck/fsck.c | 10 |
1 files changed, 6 insertions, 4 deletions
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 <sys/param.h> #include <sys/mount.h> @@ -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 == '-') { |