Skip to content

Commit 0e6b9ca

Browse files
kbleesGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
Win32: fix 'lstat("dir/")' with long paths
Use a suffciently large buffer to strip the trailing slash. Signed-off-by: Karsten Blees <[email protected]>
1 parent 484eded commit 0e6b9ca

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compat/mingw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
10341034
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
10351035
{
10361036
size_t namelen;
1037-
char alt_name[PATH_MAX];
1037+
char alt_name[MAX_LONG_PATH];
10381038

10391039
if (!do_lstat(follow, file_name, buf))
10401040
return 0;
@@ -1050,7 +1050,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
10501050
return -1;
10511051
while (namelen && file_name[namelen-1] == '/')
10521052
--namelen;
1053-
if (!namelen || namelen >= PATH_MAX)
1053+
if (!namelen || namelen >= MAX_LONG_PATH)
10541054
return -1;
10551055

10561056
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)