Author: tfaber
Date: Thu Feb 26 08:04:03 2015
New Revision: 66463
URL:
http://svn.reactos.org/svn/reactos?rev=66463&view=rev
Log:
[NTOS:CM]
- Addendum to r66462: don't forget to check buffer length
CORE-9267
Modified:
trunk/reactos/ntoskrnl/config/cmparse.c
Modified: trunk/reactos/ntoskrnl/config/cmparse.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmparse.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmparse.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/cmparse.c [iso-8859-1] Thu Feb 26 08:04:03 2015
@@ -24,6 +24,8 @@
{
BOOLEAN NameValid = TRUE;
+ NT_ASSERT(RemainingName->Length % sizeof(WCHAR) == 0);
+
/* Check if there's nothing left in the name */
if (!(RemainingName->Buffer) ||
(!RemainingName->Length) ||
@@ -37,7 +39,8 @@
}
/* Check if we have a path separator */
- while (*RemainingName->Buffer == OBJ_NAME_PATH_SEPARATOR)
+ while ((RemainingName->Length) &&
+ (*RemainingName->Buffer == OBJ_NAME_PATH_SEPARATOR))
{
/* Skip it */
RemainingName->Buffer++;
@@ -47,15 +50,9 @@
/* Start loop at where the current buffer is */
NextName->Buffer = RemainingName->Buffer;
- while (TRUE)
- {
- /* Break out if we ran out or hit a path separator */
- if (!(RemainingName->Length) ||
- (*RemainingName->Buffer == OBJ_NAME_PATH_SEPARATOR))
- {
- break;
- }
-
+ while ((RemainingName->Length) &&
+ (*RemainingName->Buffer != OBJ_NAME_PATH_SEPARATOR))
+ {
/* Move to the next character */
RemainingName->Buffer++;
RemainingName->Length -= sizeof(WCHAR);