Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2023-08-29 12:55:10 +0300
committerCorinna Vinschen <corinna@vinschen.de>2023-08-29 15:17:04 +0300
commitca2a4ec243627b19f0ac2c7262703f81712f3be4 (patch)
tree31a15406dc5dbb0a038632beaad61a4d2cd7ee31 /newlib
parent42eb6e5ddf49d81a17fffa1caaf61a668aab4692 (diff)
Cygwin: execve: drop argument size limit
Before commit 44f73c5a6206 ("Cygwin: Fix segfalt when too many command line args are specified.") we had no actual argument size limit, except for the fact that the child process created another copy of the argv array on the stack, which could result in a stack overflow and a subsequent SEGV. Commit 44f73c5a6206 changed that by allocating the additional argv array via malloc, and it introduced a new SC_ARG_MAX limit along the lines of the typical Linux limit. However, this new limit is artificial. Cygwin allocates all argument and environment data on the cygheap. We only run out of ARG_MAX space if we're out of memory resources. Change argument size handling accordingly: - Drop the args size check from child_info_spawn::worker. - Return -1 from sysconf (SC_ARG_MAX), i. e., the argument size limit is undefined. - Change argv handling in class av, so that a failing cmalloc is not fatal. This allows the parent process to return E2BIG if it's out of cygheap resources. - In the child, add a check around the new malloc call, so that it doesn't result in a SEGV if the child process gets unexpectedly into an ENOMEM situation at this point. In this (unlikely) case, proceed with the original __argv array instead. Add comment to explain why. Fixes: 44f73c5a6206 ("Cygwin: Fix segfalt when too many command line args are specified.") Tested-by: Takashi Yano <takashi.yano@nifty.ne.jp> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'newlib')
0 files changed, 0 insertions, 0 deletions