Skip to content

Commit 6ecd782

Browse files
dschoAlexpux
authored andcommitted
arg_heuristic(): be better prepared to handle path lists
If we were to handle only single paths, the buffer really would only need to fit a single one, but arg_heuristic is also used to convert e.g. INFO_PATH and MAN_PATH (which can contain multiple absolute POSIX-style paths that need to be converted to Windows-style paths). This is only really relevant if the POSIX root directory's path is already pretty long. Such a beast has been spotted in the wild, in the Git for Windows project: git-for-windows/git#303 Of course, this patch is only a work-around that helps in many, but not all cases. Obviously this patch will wait patiently until a real fix comes around the corner, and then readily retire. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent a94de84 commit 6ecd782

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

winsup/cygwin/path.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3490,7 +3490,9 @@ arg_heuristic_with_exclusions (char const * const arg, char const * exclusions,
34903490
exclusions += strlen (exclusions) + 1;
34913491
}
34923492

3493-
size_t stack_len = arglen + MAX_PATH;
3493+
// Leave enough room for at least 16 path elements; we might be converting
3494+
// a path list.
3495+
size_t stack_len = arglen + 16 * MAX_PATH;
34943496
char * stack_path = (char *)malloc (stack_len);
34953497
if (!stack_path)
34963498
{

0 commit comments

Comments
 (0)