From 18071c7b6a847a7d8703c261eea522d5398fee90 Mon Sep 17 00:00:00 2001 From: Gerrit Pape Date: Mon, 3 May 2010 11:14:47 +0800 Subject: [EVAL] Fix command -- crash 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 Signed-off-by: Herbert Xu --- ChangeLog | 4 ++++ src/eval.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bb869f2..ee78154 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-05-03 Gerrit Pape + + * Fix command -- crash. + 2010-04-15 H. Peter Anvin * Fix for job control off warning. 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 { -- cgit 1.4.1