Skip to content

Commit faed00b

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 a2ea0f0 commit faed00b

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
@@ -942,7 +942,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
942942
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
943943
{
944944
size_t namelen;
945-
char alt_name[PATH_MAX];
945+
char alt_name[MAX_LONG_PATH];
946946

947947
if (!do_lstat(follow, file_name, buf))
948948
return 0;
@@ -958,7 +958,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
958958
return -1;
959959
while (namelen && file_name[namelen-1] == '/')
960960
--namelen;
961-
if (!namelen || namelen >= PATH_MAX)
961+
if (!namelen || namelen >= MAX_LONG_PATH)
962962
return -1;
963963

964964
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)