summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--src/eval.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index de37261..e72849c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-12-23  Steve Langasek <steve.langasek@canonical.com>
+
+	* Fixed bad pointer arithmetic in evalcommand.
+
 2007-11-11  Herbert Xu <herbert@gondor.apana.org.au>
 
 	* Removed noexpand/length check on eofmark.
diff --git a/src/eval.c b/src/eval.c
index a8feaa0..77291b4 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -722,7 +722,8 @@ evalcommand(union node *cmd, int flags)
 	}
 
 	/* Reserve one extra spot at the front for shellexec. */
-	argv = nargv = stalloc(sizeof (char *) * (argc + 2)) + 1;
+	nargv = stalloc(sizeof (char *) * (argc + 2));
+	argv = ++nargv;
 	for (sp = arglist.list ; sp ; sp = sp->next) {
 		TRACE(("evalcommand arg: %s\n", sp->text));
 		*nargv++ = sp->text;