diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.com> | 2016-03-20 17:35:24 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.com> | 2016-03-20 18:17:52 -0300 |
commit | 2a69f853c03034c2e383e0f9c35b5402ce8b5473 (patch) | |
tree | 12da61d986fad63834f51d689fb023d2767a07a7 /sysdeps/unix/sysv | |
parent | 0e8e593d7339a477ad7fdc4664d5948f824f74d6 (diff) | |
download | glibc-2a69f853c03034c2e383e0f9c35b5402ce8b5473.tar.gz glibc-2a69f853c03034c2e383e0f9c35b5402ce8b5473.tar.xz glibc-2a69f853c03034c2e383e0f9c35b5402ce8b5473.zip |
posix: Fix posix_spawn invalid memory access
Current Linux posix_spawn spawn do not test if the pid argument is valid before trying to update it for success case. This patch fixes it. Tested on x86_64 and i686. * sysdeps/unix/sysv/linux/spawni.c (__spawnix): Fix invalid memory access where posix_spawn success and pid argument is null. * posix/tst-spawn.c (do_test): Add posix_spawn null pid argument for success case.
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r-- | sysdeps/unix/sysv/linux/spawni.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c index 454462be47..cb80cea00f 100644 --- a/sysdeps/unix/sysv/linux/spawni.c +++ b/sysdeps/unix/sysv/linux/spawni.c @@ -381,7 +381,7 @@ __spawnix (pid_t * pid, const char *file, close_not_cancel (args.pipe[0]); - if (!ec && new_pid) + if (!ec && pid) *pid = new_pid; __sigprocmask (SIG_SETMASK, &args.oldmask, 0); |