summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSteve Langasek <steve.langasek@canonical.com>2007-12-23 11:02:26 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2007-12-23 11:02:26 +0800
commit745e09faa22eb06e00588b198210b302c860a988 (patch)
treeaca385df0818e67a8051395629bc7fd2cd5a721c /src
parent[EXPAND] Expand here-documents in the current shell environment (diff)
downloaddash-745e09faa22eb06e00588b198210b302c860a988.tar.gz
dash-745e09faa22eb06e00588b198210b302c860a988.zip
[EVAL] Fix bad pointer arithmetic in evalcommand
dash dies on sparc with a SIGBUS due to an arithmetic error introduced
with commit 03b4958, this patch fixes it.
---

> Hi Gerrit,
>
> dash 0.5.4-3 dies on sparc with a SIGBUS due to an arithmetic error
> introduced with the patch
> 0030-EXEC-Fixed-execing-of-scripts-with-no-hash-bang.diff.  The
> attached
> patch fixes the problem.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r--src/eval.c3
1 files changed, 2 insertions, 1 deletions
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;