[PATCH] kernelbase: Check for NULL buffer in PeekNamedPipe().
Zhiyi Zhang
zzhang at codeweavers.com
Thu Sep 5 20:47:55 CDT 2019
On 9/6/19 12:09 AM, Andrey Gusev wrote:
> Signed-off-by: Andrey Gusev <andrey.goosev at 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] ))))
> {
More information about the wine-devel
mailing list