sys: FspFsvolSetRenameInformation: correctly compute Suffix for SRV2 renames

This commit is contained in:
Bill Zissimopoulos
2016-10-27 11:44:43 -07:00
parent 26092211a8
commit 5fa631339d
3 changed files with 14 additions and 8 deletions

View File

@ -1161,10 +1161,16 @@ static NTSTATUS FspFsvolSetRenameInformation(
else
FspFileNameSuffix(&FileNode->FileName, &Remain, &Suffix);
Suffix.Length = Suffix.MaximumLength = (USHORT)Info->FileNameLength;
Suffix.Length = (USHORT)Info->FileNameLength;
Suffix.Buffer = Info->FileName;
if (L'\\' == Suffix.Buffer[0])
FspFileNameSuffix(&Suffix, &NewFileName, &Suffix);
/* 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)
{
Suffix.Length = (USHORT)((EndP - P - 1) * sizeof(WCHAR));
Suffix.Buffer = P + 1;
}
Suffix.MaximumLength = Suffix.Length;
if (!FspFileNameIsValid(&Remain, 0, 0) || !FspFileNameIsValid(&Suffix, 0, 0))
{

View File

@ -41,7 +41,7 @@ BOOLEAN FspFileNameIsValid(PUNICODE_STRING Path, PUNICODE_STRING StreamPart, PUL
/* if StreamPart is not NULL, StreamType must also be not NULL */
ASSERT(0 == StreamPart || 0 != StreamType);
if (0 != Path->Length % sizeof(WCHAR))
if (0 == Path->Length || 0 != Path->Length % sizeof(WCHAR))
return FALSE;
PWSTR PathBgn, PathEnd, PathPtr, StreamTypeStr = 0;