1 diff -urN busybox.old/shell/ash.c busybox.dev/shell/ash.c
2 --- busybox.old/shell/ash.c 2005-11-12 22:39:19.853826250 +0100
3 +++ busybox.dev/shell/ash.c 2005-11-12 22:39:42.771258500 +0100
6 #define NUMBUILTINS (sizeof (builtincmd) / sizeof (struct builtincmd) )
8 +static const char *safe_applets[] = {
9 + "[", "test", "echo", "cat",
10 + "ln", "cp", "touch", "mkdir", "rm",
11 + "cut", "hexdump", "awk", "sort",
12 + "find", "xargs", "ls", "dd",
18 @@ -2050,6 +2057,19 @@
19 static void exitshell(void) __attribute__((__noreturn__));
20 static int decode_signal(const char *, int);
23 +static int is_safe_applet(char *name)
25 + int n = sizeof(safe_applets) / sizeof(char *);
27 + for (i = 0; i < n; i++)
28 + if (strcmp(safe_applets[i], name) == 0)
36 * This routine is called when an error or an interrupt occurs in an
37 * interactive shell and control is returned to the main command loop.
41 if (strchr(argv[0], '/') != NULL
42 + || is_safe_applet(argv[0])
43 #ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL
44 || find_applet_by_name(argv[0])
46 @@ -3721,6 +3742,18 @@
47 tryexec(char *cmd, char **argv, char **envp)
50 + struct BB_applet *a;
54 + if(strchr(cmd, '/') == NULL && is_safe_applet(cmd) && (a = find_applet_by_name(cmd)) != NULL) {
56 + while (*c != NULL) {
59 + bb_applet_name = cmd;
60 + exit(a->main(argc, argv));
62 #ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL
65 @@ -3919,6 +3952,12 @@
69 + if (is_safe_applet(name)) {
70 + entry->cmdtype = CMDNORMAL;
71 + entry->u.index = -1;
75 updatetbl = (path == pathval());