diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-11-01 17:16:33 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-11-01 17:16:33 +0000 |
commit | 207aae5d0003c6ec73dca23126a894f55de67fcd (patch) | |
tree | f691b5fac386d0188f4a9e1686cb27a122223377 /usr.bin/make | |
parent | bafa65c25958c608a2f35fce9372a3fe61741d88 (diff) |
Always ensure space for trailing NULL in argv
Diffstat (limited to 'usr.bin/make')
-rw-r--r-- | usr.bin/make/str.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/make/str.c b/usr.bin/make/str.c index 305ca49acfb..77f773483be 100644 --- a/usr.bin/make/str.c +++ b/usr.bin/make/str.c @@ -1,4 +1,4 @@ -/* $NetBSD: str.c,v 1.10 1995/06/14 15:19:56 christos Exp $ */ +/* $NetBSD: str.c,v 1.10.2.1 1995/10/30 22:55:14 jtc Exp $ */ /*- * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)str.c 5.8 (Berkeley) 6/1/90"; #else -static char rcsid[] = "$NetBSD: str.c,v 1.10 1995/06/14 15:19:56 christos Exp $"; +static char rcsid[] = "$NetBSD: str.c,v 1.10.2.1 1995/10/30 22:55:14 jtc Exp $"; #endif #endif /* not lint */ @@ -60,7 +60,7 @@ void str_init() { char *p1; - argv = (char **)emalloc((argmax = 50) * sizeof(char *)); + argv = (char **)emalloc(((argmax = 50) + 1) * sizeof(char *)); argv[0] = Var_Value(".MAKE", VAR_GLOBAL, &p1); } @@ -207,7 +207,7 @@ brk_string(str, store_argc, expand) if (argc == argmax) { argmax *= 2; /* ramp up fast */ if (!(argv = (char **)realloc(argv, - argmax * sizeof(char *)))) + (argmax + 1) * sizeof(char *)))) enomem(); } argv[argc++] = start; |