Skip to content

Commit e1c703c

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 46043d3 commit e1c703c

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
@@ -870,7 +870,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
870870
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
871871
{
872872
int namelen;
873-
char alt_name[PATH_MAX];
873+
char alt_name[MAX_LONG_PATH];
874874

875875
if (!do_lstat(follow, file_name, buf))
876876
return 0;
@@ -886,7 +886,7 @@ static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
886886
return -1;
887887
while (namelen && file_name[namelen-1] == '/')
888888
--namelen;
889-
if (!namelen || namelen >= PATH_MAX)
889+
if (!namelen || namelen >= MAX_LONG_PATH)
890890
return -1;
891891

892892
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)