Signed-off-by: Andrey Gusev andrey.goosev@gmail.com --- dlls/kernelbase/sync.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/kernelbase/sync.c b/dlls/kernelbase/sync.c index 31df6c7be8..bc35ff7c2a 100644 --- a/dlls/kernelbase/sync.c +++ b/dlls/kernelbase/sync.c @@ -1224,6 +1224,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH PeekNamedPipe( HANDLE pipe, LPVOID out_buffer, DWO IO_STATUS_BLOCK io; NTSTATUS status;
+ if (!buffer) return FALSE; + if (size && !(buffer = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( FILE_PIPE_PEEK_BUFFER, Data[size] )))) {
On 9/6/19 12:09 AM, Andrey Gusev wrote:
Signed-off-by: Andrey Gusev andrey.goosev@gmail.com
dlls/kernelbase/sync.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/kernelbase/sync.c b/dlls/kernelbase/sync.c index 31df6c7be8..bc35ff7c2a 100644 --- a/dlls/kernelbase/sync.c +++ b/dlls/kernelbase/sync.c @@ -1224,6 +1224,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH PeekNamedPipe( HANDLE pipe, LPVOID out_buffer, DWO IO_STATUS_BLOCK io; NTSTATUS status;
- if (!buffer) return FALSE;
Why is this change needed? 'buffer' is assigned to an address of a local variable, so it should never be NULL.
Or if you mean 'out_buffer', it could be NULL according to MSDN and you need a test to verify the change.
- if (size && !(buffer = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( FILE_PIPE_PEEK_BUFFER, Data[size] )))) {