Skip to content

Commit 1964af4

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 d4b610c commit 1964af4

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
@@ -811,7 +811,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
811811
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
812812
{
813813
int namelen;
814-
char alt_name[PATH_MAX];
814+
char alt_name[MAX_LONG_PATH];
815815

816816
if (!do_lstat(follow, file_name, buf))
817817
return 0;
@@ -827,7 +827,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
827827
return -1;
828828
while (namelen && file_name[namelen-1] == '/')
829829
--namelen;
830-
if (!namelen || namelen >= PATH_MAX)
830+
if (!namelen || namelen >= MAX_LONG_PATH)
831831
return -1;
832832

833833
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)