Skip to content

Commit c630875

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 <blees@dcon.de>
1 parent abeb314 commit c630875

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
@@ -1020,7 +1020,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
10201020
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
10211021
{
10221022
size_t namelen;
1023-
char alt_name[PATH_MAX];
1023+
char alt_name[MAX_LONG_PATH];
10241024

10251025
if (!do_lstat(follow, file_name, buf))
10261026
return 0;
@@ -1036,7 +1036,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
10361036
return -1;
10371037
while (namelen && file_name[namelen-1] == '/')
10381038
--namelen;
1039-
if (!namelen || namelen >= PATH_MAX)
1039+
if (!namelen || namelen >= MAX_LONG_PATH)
10401040
return -1;
10411041

10421042
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)