--- branches/ros-branch-0_2_6/reactos/ntoskrnl/mm/marea.c 2005-03-23 17:12:03 UTC (rev 14282)
+++ branches/ros-branch-0_2_6/reactos/ntoskrnl/mm/marea.c 2005-03-23 17:12:58 UTC (rev 14283)
@@ -491,7 +491,8 @@
/* Check if there is enough space after the last memory area. */
AlignedAddress = MM_ROUND_UP(PreviousNode->EndingAddress, Granularity);
- if ((ULONG_PTR)HighestAddress - (ULONG_PTR)AlignedAddress >= Length)
+ if ((ULONG_PTR)HighestAddress > (ULONG_PTR)AlignedAddress &&
+ (ULONG_PTR)HighestAddress - (ULONG_PTR)AlignedAddress >= Length)
{
DPRINT("MmFindGapBottomUp: %p\n", AlignedAddress);
return AlignedAddress;
--- branches/ros-branch-0_2_6/reactos/ntoskrnl/se/token.c 2005-03-23 17:12:03 UTC (rev 14282)
+++ branches/ros-branch-0_2_6/reactos/ntoskrnl/se/token.c 2005-03-23 17:12:58 UTC (rev 14283)
@@ -1632,7 +1632,7 @@
{
// PLUID_AND_ATTRIBUTES Privileges;
KPROCESSOR_MODE PreviousMode;
-// ULONG PrivilegeCount;
+ ULONG PrivilegeCount;
PTOKEN Token;
// ULONG Length;
ULONG i;
@@ -1690,6 +1690,12 @@
&c);
#endif
+ PrivilegeCount = (BufferLength - FIELD_OFFSET(TOKEN_PRIVILEGES, Privileges)) /
+ sizeof(LUID_AND_ATTRIBUTES);
+
+ if (PreviousState != NULL)
+ PreviousState->PrivilegeCount = 0;
+
k = 0;
if (DisableAllPrivileges == TRUE)
{
@@ -1700,11 +1706,22 @@
DPRINT ("Attributes differ\n");
/* Save current privilege */
- if (PreviousState != NULL && k < PreviousState->PrivilegeCount)
+ if (PreviousState != NULL)
{
- PreviousState->Privileges[k].Luid = Token->Privileges[i].Luid;
- PreviousState->Privileges[k].Attributes = Token->Privileges[i].Attributes;
- k++;
+ if (k < PrivilegeCount)
+ {
+ PreviousState->PrivilegeCount++;
+ PreviousState->Privileges[k].Luid = Token->Privileges[i].Luid;
+ PreviousState->Privileges[k].Attributes = Token->Privileges[i].Attributes;
+ }
+ else
+ {
+ /* FIXME: Should revert all the changes, calculate how
+ * much space would be needed, set ResultLength
+ * accordingly and fail.
+ */
+ }
+ k++;
}
/* Update current privlege */
@@ -1734,11 +1751,22 @@
NewState->Privileges[j].Attributes);
/* Save current privilege */
- if (PreviousState != NULL && k < PreviousState->PrivilegeCount)
+ if (PreviousState != NULL)
{
- PreviousState->Privileges[k].Luid = Token->Privileges[i].Luid;
- PreviousState->Privileges[k].Attributes = Token->Privileges[i].Attributes;
- k++;
+ if (k < PrivilegeCount)
+ {
+ PreviousState->PrivilegeCount++;
+ PreviousState->Privileges[k].Luid = Token->Privileges[i].Luid;
+ PreviousState->Privileges[k].Attributes = Token->Privileges[i].Attributes;
+ }
+ else
+ {
+ /* FIXME: Should revert all the changes, calculate how
+ * much space would be needed, set ResultLength
+ * accordingly and fail.
+ */
+ }
+ k++;
}
/* Update current privlege */