Author: dgorbachev
Date: Sun Aug 16 03:20:15 2009
New Revision: 42722
URL:
http://svn.reactos.org/svn/reactos?rev=42722&view=rev
Log:
Fix FsRtlDissectName(). Pierre Schweitzer.
Modified:
trunk/reactos/ntoskrnl/fsrtl/name.c
Modified: trunk/reactos/ntoskrnl/fsrtl/name.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fsrtl/name.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/fsrtl/name.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/fsrtl/name.c [iso-8859-1] Sun Aug 16 03:20:15 2009
@@ -142,6 +142,10 @@
ULONG FirstPosition, i;
ULONG SkipFirstSlash = 0;
+ /* Zero the strings before continuing */
+ RtlZeroMemory(FirstPart, sizeof(UNICODE_STRING));
+ RtlZeroMemory(RemainingPart, sizeof(UNICODE_STRING));
+
/* Just quit if the string is empty */
if (!Name.Length) return;
@@ -169,14 +173,14 @@
/* Set up the first result string */
FirstPart->Buffer = Name.Buffer + SkipFirstSlash;
FirstPart->Length = (FirstPosition - SkipFirstSlash) * sizeof(WCHAR);
- FirstPart->MaximumLength = Name.MaximumLength - FirstPart->Length;
+ FirstPart->MaximumLength = FirstPart->Length;
/* And second one, if necessary */
if (FirstPosition < (Name.Length / sizeof(WCHAR)))
{
RemainingPart->Buffer = Name.Buffer + FirstPosition + 1;
- RemainingPart->Length = (Name.Length - FirstPosition) * sizeof(WCHAR);
- RemainingPart->MaximumLength = Name.MaximumLength - RemainingPart->Length;
+ RemainingPart->Length = Name.Length - (FirstPosition + 1) * sizeof(WCHAR);
+ RemainingPart->MaximumLength = RemainingPart->Length;
}
}