Author: akhaldi
Date: Sat May 11 09:52:37 2013
New Revision: 58988

URL: http://svn.reactos.org/svn/reactos?rev=58988&view=rev
Log:
[CDFS]
* Fix the mismatch between sizeof and countof quantities in 
CdfsMakeFCBFromDirEntry.
* Properly account for '\\' and '\0'.
* Fix one more debug print specifier.

Modified:
    trunk/reactos/drivers/filesystems/cdfs/fcb.c

Modified: trunk/reactos/drivers/filesystems/cdfs/fcb.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/cdfs/fcb.c?rev=58988&r1=58987&r2=58988&view=diff
==============================================================================
--- trunk/reactos/drivers/filesystems/cdfs/fcb.c        [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/cdfs/fcb.c        [iso-8859-1] Sat May 11 
09:52:37 2013
@@ -363,8 +363,9 @@
     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 @@
     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);
 }


Reply via email to