Skip to content

Commit 792a469

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 c4ee517 commit 792a469

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
@@ -941,7 +941,7 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
941941
static int do_stat_internal(int follow, const char *file_name, struct stat *buf)
942942
{
943943
int namelen;
944-
char alt_name[PATH_MAX];
944+
char alt_name[MAX_LONG_PATH];
945945

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

963963
memcpy(alt_name, file_name, namelen);

0 commit comments

Comments
 (0)