From 66e214d186bf50c647b8516c1f4a1a7cd40d5ea3 Mon Sep 17 00:00:00 2001 From: Quentin Rameau Date: Sun, 11 Mar 2018 14:47:45 +0100 Subject: Continue trying execution with "/bin/sh" for execlp and execvp As Rick stated, this isn't a clean solution because argv can be arbirtary long and overflow the stack. I post it here in case you'd find it useful anyway. --- src/process/execsh.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/process/execsh.c (limited to 'src/process/execsh.c') diff --git a/src/process/execsh.c b/src/process/execsh.c new file mode 100644 index 00000000..180bb2aa --- /dev/null +++ b/src/process/execsh.c @@ -0,0 +1,18 @@ +#include +#include +#include "libc.h" + +int +__execsh(const char *file, char *const argv[]) +{ + int i, argc; + char **p; + + for (argc=1, p=(char **)argv; *p; ++argc, ++p); + + char *nargv[argc+1]; + nargv[0] = (char *)file; + for (i=0; i