mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 04:13:34 +00:00
- ReadEventLogA/ReadEventLogW: Check for lpBuffer for NULL and if so set nNumberOfBytesToRead to zero so that rpcrt4 does not access a NULL buffer.
Set pnBytesRead and pnMinNumberOfBytesNeeded variables prior to checking for failure and returning FALSE. In preparation for implementation of EventLog. svn path=/trunk/; revision=40953
This commit is contained in:
@@ -632,6 +632,13 @@ ReadEventLogA(IN HANDLE hEventLog,
|
||||
hEventLog, dwReadFlags, dwRecordOffset, lpBuffer,
|
||||
nNumberOfBytesToRead, pnBytesRead, pnMinNumberOfBytesNeeded);
|
||||
|
||||
/* If buffer is NULL set nNumberOfBytesToRead to 0 to prevent rpcrt4 from
|
||||
trying to access a null pointer */
|
||||
if (!lpBuffer)
|
||||
{
|
||||
nNumberOfBytesToRead = 0;
|
||||
}
|
||||
|
||||
RpcTryExcept
|
||||
{
|
||||
Status = ElfrReadELA(hEventLog,
|
||||
@@ -648,15 +655,15 @@ ReadEventLogA(IN HANDLE hEventLog,
|
||||
}
|
||||
RpcEndExcept;
|
||||
|
||||
*pnBytesRead = (DWORD)bytesRead;
|
||||
*pnMinNumberOfBytesNeeded = (DWORD)minNumberOfBytesNeeded;
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastError(RtlNtStatusToDosError(Status));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*pnBytesRead = (DWORD)bytesRead;
|
||||
*pnMinNumberOfBytesNeeded = (DWORD)minNumberOfBytesNeeded;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -689,6 +696,13 @@ ReadEventLogW(IN HANDLE hEventLog,
|
||||
hEventLog, dwReadFlags, dwRecordOffset, lpBuffer,
|
||||
nNumberOfBytesToRead, pnBytesRead, pnMinNumberOfBytesNeeded);
|
||||
|
||||
/* If buffer is NULL set nNumberOfBytesToRead to 0 to prevent rpcrt4 from
|
||||
trying to access a null pointer */
|
||||
if (!lpBuffer)
|
||||
{
|
||||
nNumberOfBytesToRead = 0;
|
||||
}
|
||||
|
||||
RpcTryExcept
|
||||
{
|
||||
Status = ElfrReadELW(hEventLog,
|
||||
@@ -705,15 +719,15 @@ ReadEventLogW(IN HANDLE hEventLog,
|
||||
}
|
||||
RpcEndExcept;
|
||||
|
||||
*pnBytesRead = (DWORD)bytesRead;
|
||||
*pnMinNumberOfBytesNeeded = (DWORD)minNumberOfBytesNeeded;
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastError(RtlNtStatusToDosError(Status));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*pnBytesRead = (DWORD)bytesRead;
|
||||
*pnMinNumberOfBytesNeeded = (DWORD)minNumberOfBytesNeeded;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user