diff options
author | Rich Felker <dalias@aerifal.cx> | 2013-10-03 10:16:01 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2013-10-03 10:16:01 -0400 |
commit | 2b2aff37aced66e4a50a38a14607a9b1dc0ee001 (patch) | |
tree | b8473d323d03458372a1bada847a060ff5a20b0b | |
parent | 23b8e3bc95620b0bd90a78ce0d926942c12b45da (diff) | |
download | musl-2b2aff37aced66e4a50a38a14607a9b1dc0ee001.tar.gz musl-2b2aff37aced66e4a50a38a14607a9b1dc0ee001.tar.bz2 musl-2b2aff37aced66e4a50a38a14607a9b1dc0ee001.tar.xz musl-2b2aff37aced66e4a50a38a14607a9b1dc0ee001.zip |
fix new environment always being null with execle
the va_arg call for the argv[]-terminating null pointer was missing,
so this pointer was being wrongly used as the environment pointer.
issue reported by Timo Teräs. proposed patch slightly modified to
simplify the resulting code.
-rw-r--r-- | src/process/execle.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/process/execle.c b/src/process/execle.c index 64908366..6f2ec055 100644 --- a/src/process/execle.c +++ b/src/process/execle.c @@ -14,9 +14,8 @@ int execle(const char *path, const char *argv0, ...) char **envp; va_start(ap, argv0); argv[0] = (char *)argv0; - for (i=1; i<argc; i++) + for (i=1; i<=argc; i++) argv[i] = va_arg(ap, char *); - argv[i] = NULL; envp = va_arg(ap, char **); return execve(path, argv, envp); } |