Add parameters check to ReadEventLog.
authorSylvain Petreolle <spetreolle@yahoo.fr>
Sun, 17 Jan 2010 21:40:39 +0000 (21:40 +0000)
committerSylvain Petreolle <spetreolle@yahoo.fr>
Sun, 17 Jan 2010 21:40:39 +0000 (21:40 +0000)
Fixes last advapi32:eventlog crash

svn path=/trunk/; revision=45125

reactos/dll/win32/advapi32/service/eventlog.c

index 7a4acb5..23b138b 100644 (file)
@@ -673,6 +673,12 @@ ReadEventLogA(IN HANDLE hEventLog,
         hEventLog, dwReadFlags, dwRecordOffset, lpBuffer,
         nNumberOfBytesToRead, pnBytesRead, pnMinNumberOfBytesNeeded);
 
+    if(!pnBytesRead || !pnMinNumberOfBytesNeeded)
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return FALSE;
+    }
+
     /* If buffer is NULL set nNumberOfBytesToRead to 0 to prevent rpcrt4 from
        trying to access a null pointer */
     if (!lpBuffer)
@@ -737,6 +743,12 @@ ReadEventLogW(IN HANDLE hEventLog,
         hEventLog, dwReadFlags, dwRecordOffset, lpBuffer,
         nNumberOfBytesToRead, pnBytesRead, pnMinNumberOfBytesNeeded);
 
+    if(!pnBytesRead || !pnMinNumberOfBytesNeeded)
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return FALSE;
+    }
+
     /* If buffer is NULL set nNumberOfBytesToRead to 0 to prevent rpcrt4 from
        trying to access a null pointer */
     if (!lpBuffer)