]> sourceware.org Git - newlib-cygwin.git/commit
Cygwin: Fix segfalt when too many command line args are specified.
authorTakashi Yano <takashi.yano@nifty.ne.jp>
Mon, 28 Aug 2023 13:14:41 +0000 (22:14 +0900)
committerTakashi Yano <takashi.yano@nifty.ne.jp>
Mon, 28 Aug 2023 15:19:54 +0000 (00:19 +0900)
commit33cddf77974f9849cf8edafe9b3da46591b73d6e
treeb78b518b59611e50f5a91404ae5b056681fd19c8
parent208c3f68a30a7ab6cc53f30f8a119694ed29c866
Cygwin: Fix segfalt when too many command line args are specified.

Previously, the number of command line args was not checked for
cygwin process. Due to this, segmentation fault was caused if too
many command line args are specified.
https://cygwin.com/pipermail/cygwin/2023-August/254333.html

Since char *argv[argc + 1] is placed on the stack in dll_crt0_1(),
STATUS_STACK_OVERFLOW occurs if the stack does not have enough
space.

With this patch, char *argv[] is placed in heap instead of stack
and ARG_MAX is increased from 32000 to 2097152 which is default
value of Linux. The argument length is also compared with ARG_MAX
and spawnve() returns E2BIG if it is too long.

Reported-by: Ed Morton
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
winsup/cygwin/dcrt0.cc
winsup/cygwin/local_includes/winsup.h
winsup/cygwin/release/3.4.9
winsup/cygwin/spawn.cc
winsup/cygwin/sysconf.cc
This page took 0.030444 seconds and 5 git commands to generate.