busybox sh -c 'command --' segfaults because parse_command_args
returns a pointer to a null pointer.

Based on commit 18071c7 from git://git.kernel.org/pub/scm/utils/dash/dash.git
by Gerrit Pape.

function                                             old     new   delta
evalcommand                                         1368    1350     -18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-18)             Total: -18 bytes

Signed-off-by: Ron Yorston <[email protected]>
---
 shell/ash.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/shell/ash.c b/shell/ash.c
index 7f3808b..ddcd28b 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -8885,8 +8885,8 @@ parse_command_args(char **argv, const char **path)
                if (!c)
                        break;
                if (c == '-' && !*cp) {
-                       argv++;
-                       break;
+                       if (!*++argv)
+                               return 0;
                }
                do {
                        switch (c) {
-- 
2.4.3

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to