From 5045403d85175e5d90debfb041734e99a9c631ad Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Mon, 28 Sep 2020 16:01:38 -0700 Subject: [PATCH] sys: FspFsvolSetRenameInformation: tolerate trailing backslash on target name --- src/sys/fileinfo.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sys/fileinfo.c b/src/sys/fileinfo.c index 454b83ca..b0316476 100644 --- a/src/sys/fileinfo.c +++ b/src/sys/fileinfo.c @@ -1589,6 +1589,10 @@ retry: Suffix.Length = (USHORT)Info->FileNameLength; Suffix.Buffer = Info->FileName; + /* remove any trailing backslash */ + if (sizeof(WCHAR) * 2/* not empty or root */ <= Suffix.Length && + L'\\' == Suffix.Buffer[Suffix.Length / sizeof(WCHAR) - 1]) + Suffix.Length -= sizeof(WCHAR); /* if there is a backslash anywhere in the NewFileName get its suffix */ for (PWSTR P = Suffix.Buffer, EndP = P + Suffix.Length / sizeof(WCHAR); EndP > P; P++) if (L'\\' == *P)