Skip to content

Commit 7bd3018

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 bd3a59c commit 7bd3018

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
@@ -917,7 +917,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
917917
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
918918
{
919919
int namelen;
920-
char alt_name[PATH_MAX];
920+
char alt_name[MAX_LONG_PATH];
921921

922922
if (!do_lstat(follow, file_name, buf))
923923
return 0;
@@ -933,7 +933,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
933933
return -1;
934934
while (namelen && file_name[namelen-1] == '/')
935935
--namelen;
936-
if (!namelen || namelen >= PATH_MAX)
936+
if (!namelen || namelen >= MAX_LONG_PATH)
937937
return -1;
938938

939939
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)