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.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
for (;;) {
cp = *++argv;
if (!cp)
- return 0;
+ return NULL;
if (*cp++ != '-')
break;
c = *cp++;
if (!c)
break;
if (c == '-' && !*cp) {
- argv++;
+ if (!*++argv)
+ return NULL;
break;
}
do {
break;
default:
/* run 'typecmd' for other options */
- return 0;
+ return NULL;
}
c = *cp++;
} while (c);