* Fix the mismatch between sizeof and countof quantities in CdfsMakeFCBFromDirEntry.
* Properly account for '\\' and '\0'.
* Fix one more debug print specifier.

svn path=/trunk/; revision=58988
This commit is contained in:
Amine Khaldi
2013-05-11 09:52:37 +00:00
parent 1e4828d3f8
commit 8ba55e9b6f
+4 -3
View File
@@ -363,8 +363,9 @@ CdfsMakeFCBFromDirEntry(PVCB Vcb,
PFCB rcFCB;
ULONG Size;
if (LongName [0] != 0 && wcslen (DirectoryFCB->PathName) +
sizeof(WCHAR) + wcslen (LongName) > MAX_PATH)
/* Check if the full string would overflow the pathName buffer (the additional characters are for '\\' and '\0') */
if ((LongName[0] != 0) &&
(wcslen(DirectoryFCB->PathName) + 1 + wcslen(LongName) + 1 > MAX_PATH))
{
return(STATUS_OBJECT_NAME_INVALID);
}
@@ -411,7 +412,7 @@ CdfsMakeFCBFromDirEntry(PVCB Vcb,
CdfsAddFCBToTable(Vcb, rcFCB);
*fileFCB = rcFCB;
DPRINT("%S %d %I64d\n", LongName, Size, rcFCB->RFCB.AllocationSize.QuadPart);
DPRINT("%S %u %I64d\n", LongName, Size, rcFCB->RFCB.AllocationSize.QuadPart);
return(STATUS_SUCCESS);
}