Here's another bug bisecting to f42e443bb ([EXPAND] Fix
ifsfirst/ifslastp leak, 2010-09-08).  It was found with the following
test case, based on the configure script for Tracker:

        dash -x -c '
                <<-_ACEOF
                $@
                _ACEOF
                exec
        ' - abcdefgh
        +
        + exec   �a
        exec: 1: : Permission denied

The missing ifsfree call is in expandarg when it returns to openhere
during here document expansion.

Reported-by: Aurelien Jarno <aure...@debian.org>
Signed-off-by: Jonathan Nieder <jrnie...@gmail.com>
---
Hi,

Aurelien Jarno wrote[1]:

>   
> https://buildd.debian.org/fetch.cgi?pkg=tracker&arch=amd64&ver=0.10.3-1&stamp=1299968124&file=log&as=raw
[...]
> |  57145 dash     CALL  execve(0x806bf64,0x806ba64,0x806bef4)
> |  57145 dash     NAMI  "/usr/local/bincd$e,f4g<hDnLoTpu"

This patch seems to fix it.  Thoughts?

[1] http://bugs.debian.org/618023

 src/expand.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/expand.c b/src/expand.c
index 7a9b157..eac6c6d 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -194,6 +194,7 @@ expandarg(union node *arg, struct arglist *arglist, int 
flag)
        p = _STPUTC('\0', expdest);
        expdest = p - 1;
        if (arglist == NULL) {
+               ifsfree();
                return;                 /* here document expanded */
        }
        p = grabstackstr(p);
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to