Skip to content

Commit faff0b3

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 625106c commit faff0b3

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
@@ -940,7 +940,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
940940
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
941941
{
942942
int namelen;
943-
char alt_name[PATH_MAX];
943+
char alt_name[MAX_LONG_PATH];
944944

945945
if (!do_lstat(follow, file_name, buf))
946946
return 0;
@@ -956,7 +956,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
956956
return -1;
957957
while (namelen && file_name[namelen-1] == '/')
958958
--namelen;
959-
if (!namelen || namelen >= PATH_MAX)
959+
if (!namelen || namelen >= MAX_LONG_PATH)
960960
return -1;
961961

962962
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)