public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/cygwin-3_3-branch] Cygwin: path: Fix UNC path handling for SMB3 mounted to a drive.
@ 2022-02-03 9:30 Takashi Yano
0 siblings, 0 replies; only message in thread
From: Takashi Yano @ 2022-02-03 9:30 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=71d5490a3a2d769e1893f11c98edb06468ad6af4
commit 71d5490a3a2d769e1893f11c98edb06468ad6af4
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date: Thu Feb 3 12:00:14 2022 +0900
Cygwin: path: Fix UNC path handling for SMB3 mounted to a drive.
- If an UNC path is mounted to a drive using SMB3.11, accessing to
the drive fails with error "Too many levels of symbolic links."
This patch fixes the issue.
Diff:
---
winsup/cygwin/path.cc | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 87ac2404a..4ad4e0821 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -3495,10 +3495,19 @@ restart:
/* If incoming path has no trailing backslash, but final path
has one, drop trailing backslash from final path so the
- below string comparison has a chance to succeed. */
+ below string comparison has a chance to succeed.
+ On the contrary, if incoming path has trailing backslash,
+ but final path does not have one, add trailing backslash
+ to the final path. */
if (upath.Buffer[(upath.Length - 1) / sizeof (WCHAR)] != L'\\'
- && fpbuf[ret - 1] == L'\\')
+ && fpbuf[ret - 1] == L'\\')
fpbuf[--ret] = L'\0';
+ if (upath.Buffer[(upath.Length - 1) / sizeof (WCHAR)] == L'\\'
+ && fpbuf[ret - 1] != L'\\' && ret < NT_MAX_PATH - 1)
+ {
+ fpbuf[ret++] = L'\\';
+ fpbuf[ret] = L'\0';
+ }
fpbuf[1] = L'?'; /* \\?\ --> \??\ */
RtlInitCountedUnicodeString (&fpath, fpbuf, ret * sizeof (WCHAR));
if (!RtlEqualUnicodeString (&upath, &fpath, !!ci_flag))
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-03 9:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-03 9:30 [newlib-cygwin/cygwin-3_3-branch] Cygwin: path: Fix UNC path handling for SMB3 mounted to a drive Takashi Yano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).