Skip to content

Commit e475c17

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 b833e91 commit e475c17

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compat/mingw.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
10101010
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
10111011
{
10121012
size_t namelen;
1013-
char alt_name[PATH_MAX];
1013+
char alt_name[MAX_LONG_PATH];
10141014

10151015
if (!do_lstat(follow, file_name, buf))
10161016
return 0;
@@ -1026,7 +1026,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
10261026
return -1;
10271027
while (namelen && file_name[namelen-1] == '/')
10281028
--namelen;
1029-
if (!namelen || namelen >= PATH_MAX)
1029+
if (!namelen || namelen >= MAX_LONG_PATH)
10301030
return -1;
10311031

10321032
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)