Author: khornicek
Date: Mon Oct 10 13:37:19 2011
New Revision: 54072
URL:
http://svn.reactos.org/svn/reactos?rev=54072&view=rev
Log:
[CDFS]
Fix a buffer overrun that was corrupting the FCB.
See issue #4086 for more details.
Modified:
trunk/reactos/drivers/filesystems/cdfs/dirctl.c
Modified: trunk/reactos/drivers/filesystems/cdfs/dirctl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/cdfs/d…
==============================================================================
--- trunk/reactos/drivers/filesystems/cdfs/dirctl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/cdfs/dirctl.c [iso-8859-1] Mon Oct 10 13:37:19 2011
@@ -325,7 +325,8 @@
DPRINT("PathName '%S' ObjectName '%S'\n",
Fcb->PathName, Fcb->ObjectName);
memcpy(&Fcb->Entry, Record, sizeof(DIR_RECORD));
- wcsncpy(Fcb->ObjectName, name, MAX_PATH);
+ wcsncpy(Fcb->ObjectName, name, min(wcslen(name) + 1,
+ MAX_PATH - wcslen(Fcb->PathName) + wcslen(Fcb->ObjectName)));
/* Copy short name */
Fcb->ShortNameU.Length = ShortName.Length;