[BusyBox] bug#1209: `-/bin/sh' invocation fails
Matt Kraai
kraai at alumni.carnegiemellon.edu
Sun Aug 26 02:15:03 UTC 2001
Package: busybox
Version: 0.60.1
If argv[0] contains both a leading dash and a full pathname, the
dash removal resets the applet_name to the full pathname,
including the leading directory components. This prevents the
applet from being found and invoked.
The attached patch should fix the problem.
Matt
--- busybox-0.60.1.orig/busybox.c Wed Jun 20 21:56:24 2001
+++ busybox/busybox.c Sun Aug 26 06:40:12 2001
@@ -69,15 +69,14 @@
{
const char *s;
- for (s = applet_name = argv[0]; *s != '\0';) {
+ applet_name = argv[0];
+
+ if (applet_name[0] == '-')
+ applet_name++;
+
+ for (s = applet_name; *s != '\0';)
if (*s++ == '/')
applet_name = s;
- }
-
- /* Add in a special case hack for a leading hyphen */
- if (**argv == '-' && *(*argv+1)!= '-') {
- applet_name = (*argv+1);
- }
#ifdef BB_LOCALE_SUPPORT
#ifdef BB_INIT
More information about the busybox
mailing list