sys: FspFsvolSetRenameInformation: tolerate trailing backslash on target name

This commit is contained in:
Bill Zissimopoulos 2020-09-28 16:01:38 -07:00
parent 13a52c4ab4
commit 5045403d85
No known key found for this signature in database
GPG Key ID: 3D4F95D52C7B3EA3

View File

@ -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)