Author: hbelusca
Date: Mon Nov 7 13:57:11 2016
New Revision: 73168
URL:
http://svn.reactos.org/svn/reactos?rev=73168&view=rev
Log:
[NTOS:IO]: An improvement for the total log size check (addendum to r73167).
Modified:
trunk/reactos/ntoskrnl/io/iomgr/error.c
Modified: trunk/reactos/ntoskrnl/io/iomgr/error.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/error.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/error.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/error.c [iso-8859-1] Mon Nov 7 13:57:11 2016
@@ -554,10 +554,6 @@
return NULL;
}
- /* Check if we're past our buffer */
- // FIXME/TODO: Perform the checks by taking into account EntrySize.
- if (IopTotalLogSize > IOP_MAXIMUM_LOG_SIZE) return NULL;
-
/* Check whether the size is too small or too large */
if ((EntrySize < sizeof(IO_ERROR_LOG_PACKET)) ||
(EntrySize > ERROR_LOG_MAXIMUM_SIZE))
@@ -566,11 +562,15 @@
return NULL;
}
- /* Round up the size */
+ /* Round up the size and calculate the total size */
EntrySize = ROUND_UP(EntrySize, sizeof(PVOID));
-
- /* Calculate the total size and allocate it */
LogEntrySize = sizeof(ERROR_LOG_ENTRY) + EntrySize;
+
+ /* Check if we're past our buffer */
+ // TODO: Improve (what happens in case of concurrent calls?)
+ if (IopTotalLogSize + LogEntrySize > IOP_MAXIMUM_LOG_SIZE) return NULL;
+
+ /* Allocate the entry */
LogEntry = ExAllocatePoolWithTag(NonPagedPool,
LogEntrySize,
TAG_ERROR_LOG);