From: Will Dietz Date: Thu, 14 Sep 2017 21:32:59 +0000 (-0500) Subject: posix_spawn: use larger stack to cover worst-case in execvpe X-Git-Tag: v1.1.18~3 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=004dc9549b8003288e635ba5aa91e3353e1974c4;p=oweals%2Fmusl.git posix_spawn: use larger stack to cover worst-case in execvpe execvpe stack-allocates a buffer used to hold the full path (combination of a PATH entry and the program name) while searching through $PATH, so at least NAME_MAX+PATH_MAX is needed. The stack size can be made conditionally smaller (the current 1024 appears appropriate) should this larger size be burdensome in those situations. --- diff --git a/src/process/posix_spawn.c b/src/process/posix_spawn.c index ea5d2998..0849c71f 100644 --- a/src/process/posix_spawn.c +++ b/src/process/posix_spawn.c @@ -152,7 +152,7 @@ int __posix_spawnx(pid_t *restrict res, const char *restrict path, char *const argv[restrict], char *const envp[restrict]) { pid_t pid; - char stack[1024]; + char stack[1024+PATH_MAX]; int ec=0, cs; struct args args;