Skip to content

Commit a5d11ab

Browse files
kbleesdscho
authored andcommitted
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 94378c1 commit a5d11ab

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
@@ -1009,7 +1009,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
10091009
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
10101010
{
10111011
size_t namelen;
1012-
char alt_name[PATH_MAX];
1012+
char alt_name[MAX_LONG_PATH];
10131013

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

10311031
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)