From 7fba80493bf077322a16e98bfeb11990a9c89340 Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Sat, 14 Apr 2012 17:52:51 +0200 Subject: [PATCH] Don't do a shell `exec' on mhshow-show-* contents to make `foo; bar' possible. --- uip/mhshowsbr.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index fe3afc4..e2cde4d 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -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); -- 1.7.10.4