Don't do a shell `exec' on mhshow-show-* contents to make `foo; bar' possible.
authormarkus schnalke <meillo@marmaro.de>
Sat, 14 Apr 2012 15:52:51 +0000 (17:52 +0200)
committermarkus schnalke <meillo@marmaro.de>
Sat, 14 Apr 2012 15:52:51 +0000 (17:52 +0200)
uip/mhshowsbr.c

index fe3afc4..e2cde4d 100644 (file)
@@ -468,7 +468,6 @@ show_content_aux2(CT ct, int alternate, char *cracked,
        char *buffer, int fd, int xlist, int xstdin, int xtty)
 {
        pid_t child_id;
-       char *vec[4], exec[BUFSIZ + sizeof "exec "];
 
        if (debugsw || cracked) {
                fflush(stdout);
@@ -498,13 +497,6 @@ show_content_aux2(CT ct, int alternate, char *cracked,
                        list_switch(ct, -1, 1, 0, 0);
        }
 
-       snprintf(exec, sizeof(exec), "exec %s", buffer);
-
-       vec[0] = "/bin/sh";
-       vec[1] = "-c";
-       vec[2] = exec;
-       vec[3] = NULL;
-
        fflush(stdout);
 
        switch (child_id = fork()) {
@@ -519,7 +511,7 @@ show_content_aux2(CT ct, int alternate, char *cracked,
                if (!xstdin)
                        dup2(fd, 0);
                close(fd);
-               execvp("/bin/sh", vec);
+               execlp("/bin/sh", "/bin/sh", "-c", buffer, NULL);
                fprintf(stderr, "unable to exec ");
                perror("/bin/sh");
                _exit(-1);