parse_command_args() returning a **argv pointer with *argv == 0 makes
dash segfault in find_command().  To reproduce run

 dash -c 'command --'

With this commit, parse_command_args() returns 0 if *argv is null after
parsing --, and so fixes the subsequent segfault.

Reported by Jonny through http://bugs.debian.org/579543

Signed-off-by: Gerrit Pape <[email protected]>
---
 src/eval.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/eval.c b/src/eval.c
index 2f195af..62d9d5d 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -651,7 +651,8 @@ parse_command_args(char **argv, const char **path)
                if (!(c = *cp++))
                        break;
                if (c == '-' && !*cp) {
-                       argv++;
+                       if (!*++argv)
+                               return 0;
                        break;
                }
                do {
-- 
1.7.0.3

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

Reply via email to