From ad12df089efca37695d2c12d022426e944e7af4f Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sat, 15 Aug 1998 20:16:35 +0000 Subject: fix realloc --- sbin/ccdconfig/ccdconfig.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sbin/ccdconfig/ccdconfig.c b/sbin/ccdconfig/ccdconfig.c index 6986d8089a4..3e842304cfb 100644 --- a/sbin/ccdconfig/ccdconfig.c +++ b/sbin/ccdconfig/ccdconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ccdconfig.c,v 1.11 1998/07/08 22:24:54 deraadt Exp $ */ +/* $OpenBSD: ccdconfig.c,v 1.12 1998/08/15 20:16:34 deraadt Exp $ */ /* $NetBSD: ccdconfig.c,v 1.6 1996/05/16 07:11:18 thorpej Exp $ */ /*- @@ -328,6 +328,7 @@ do_all(action) char *cp, **argv; int argc, rval = 0; gid_t egid; + char **nargv; egid = getegid(); setegid(getgid()); @@ -351,11 +352,12 @@ do_all(action) for (cp = line; (cp = strtok(cp, " \t")) != NULL; cp = NULL) { if (*cp == '#') break; - if ((argv = realloc(argv, + if ((nargv = realloc(argv, sizeof(char *) * ++argc)) == NULL) { warnx("no memory to configure ccds"); return (1); } + argv = nargv; argv[argc - 1] = cp; /* * If our action is to unconfigure all, then pass -- cgit v1.2.3