Skip to content

Commit 854256e

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 2605518 commit 854256e

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
@@ -718,7 +718,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
718718
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
719719
{
720720
int namelen;
721-
char alt_name[PATH_MAX];
721+
char alt_name[MAX_LONG_PATH];
722722

723723
if (!do_lstat(follow, file_name, buf))
724724
return 0;
@@ -734,7 +734,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
734734
return -1;
735735
while (namelen && file_name[namelen-1] == '/')
736736
--namelen;
737-
if (!namelen || namelen >= PATH_MAX)
737+
if (!namelen || namelen >= MAX_LONG_PATH)
738738
return -1;
739739

740740
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)