diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 23d5db046f..2dd9274d21 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -3490,7 +3490,9 @@ arg_heuristic_with_exclusions (char const * const arg, char const * exclusions, exclusions += strlen (exclusions) + 1; } - size_t stack_len = arglen + MAX_PATH; + // Leave enough room for at least 16 path elements; we might be converting + // a path list. + size_t stack_len = arglen + 16 * MAX_PATH; char * stack_path = (char *)malloc (stack_len); if (!stack_path) {