]> 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:17:30 +0000 (00:17 +0900)
commit44f73c5a620689d6821c4bd0444051be57f8251a
treef4fd09528dfe641d98603d7ac03277eca7158ebf
parent50ff7901a5dbb2c57548d1bc125bbfbd17d37889
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.028715 seconds and 5 git commands to generate.