[ros-diffs] [pschweitzer] 34577: Bugfixes: - FsRtlDissectDbcs, FsRtlDissectName: zero output memory before use - FsRtlDissectName: fixed output string length calculation - FsRtlIsFatDbcsLegal: removed useless code thanks to fixes in FsRtlDissectDbcs

pschweitzer at svn.reactos.org pschweitzer at svn.reactos.org
Fri Jul 18 21:35:57 CEST 2008


Author: pschweitzer
Date: Fri Jul 18 14:35:57 2008
New Revision: 34577

URL: http://svn.reactos.org/svn/reactos?rev=34577&view=rev
Log:
Bugfixes:
- FsRtlDissectDbcs, FsRtlDissectName: zero output memory before use
- FsRtlDissectName: fixed output string length calculation
- FsRtlIsFatDbcsLegal: removed useless code thanks to fixes in FsRtlDissectDbcs

Modified:
    branches/pierre-fsd/ntoskrnl/fsrtl/dbcsname.c
    branches/pierre-fsd/ntoskrnl/fsrtl/name.c

Modified: branches/pierre-fsd/ntoskrnl/fsrtl/dbcsname.c
URL: http://svn.reactos.org/svn/reactos/branches/pierre-fsd/ntoskrnl/fsrtl/dbcsname.c?rev=34577&r1=34576&r2=34577&view=diff
==============================================================================
--- branches/pierre-fsd/ntoskrnl/fsrtl/dbcsname.c [iso-8859-1] (original)
+++ branches/pierre-fsd/ntoskrnl/fsrtl/dbcsname.c [iso-8859-1] Fri Jul 18 14:35:57 2008
@@ -49,6 +49,10 @@
     ULONG FirstPosition, i;
     ULONG SkipFirstSlash = 0;
 
+    /* Zero the strings before continuing */
+    RtlZeroMemory(FirstPart, sizeof(*FirstPart));
+    RtlZeroMemory(RemainingPart, sizeof(*RemainingPart));
+
     /* Just quit if the string is empty */
     if (!Name.Length) return;
 
@@ -209,10 +213,6 @@
         DbcsName.MaximumLength = DbcsName.MaximumLength - 1;
     }
 
-    /* Zero strings for further use */
-    RtlZeroMemory(&FirstPart, sizeof(FirstPart));
-    RtlZeroMemory(&RemainingPart, sizeof(RemainingPart));
-
     /* Extract first part of the DbcsName to work on */
     FsRtlDissectDbcs(DbcsName, &FirstPart, &RemainingPart);
     while (FirstPart.Length > 0)
@@ -283,8 +283,6 @@
         Name.Buffer = RemainingPart.Buffer;
         Name.Length = RemainingPart.Length;
         Name.MaximumLength = RemainingPart.MaximumLength;
-        RtlZeroMemory(&FirstPart, sizeof(FirstPart));
-        RtlZeroMemory(&RemainingPart, sizeof(RemainingPart));
 
         /* Call once again our dissect function */
         FsRtlDissectDbcs(Name, &FirstPart, &RemainingPart);

Modified: branches/pierre-fsd/ntoskrnl/fsrtl/name.c
URL: http://svn.reactos.org/svn/reactos/branches/pierre-fsd/ntoskrnl/fsrtl/name.c?rev=34577&r1=34576&r2=34577&view=diff
==============================================================================
--- branches/pierre-fsd/ntoskrnl/fsrtl/name.c [iso-8859-1] (original)
+++ branches/pierre-fsd/ntoskrnl/fsrtl/name.c [iso-8859-1] Fri Jul 18 14:35:57 2008
@@ -142,6 +142,10 @@
     ULONG FirstPosition, i;
     ULONG SkipFirstSlash = 0;
 
+    /* Zero the strings before continuing */
+    RtlZeroMemory(FirstPart, sizeof(*FirstPart));
+    RtlZeroMemory(RemainingPart, sizeof(*RemainingPart));
+
     /* Just quit if the string is empty */
     if (!Name.Length) return;
 
@@ -175,7 +179,7 @@
     if (FirstPosition < (Name.Length / sizeof(WCHAR)))
     {
         RemainingPart->Buffer = Name.Buffer + FirstPosition + 1;
-        RemainingPart->Length = (Name.Length - FirstPosition) * sizeof(WCHAR);
+        RemainingPart->Length = Name.Length - (FirstPosition + 1) * sizeof(WCHAR);
         RemainingPart->MaximumLength = Name.MaximumLength - RemainingPart->Length;
     }
 }



More information about the Ros-diffs mailing list