From: markus schnalke Date: Sat, 14 Apr 2012 15:52:51 +0000 (+0200) Subject: Don't do a shell `exec' on mhshow-show-* contents to make `foo; bar' possible. X-Git-Tag: mmh-thesis-end~86 X-Git-Url: http://git.marmaro.de/?p=mmh;a=commitdiff_plain;h=7fba80493bf077322a16e98bfeb11990a9c89340 Don't do a shell `exec' on mhshow-show-* contents to make `foo; bar' possible. --- 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);