conhost: Improve bound checking in fill_output.

Inspired by Pengpeng Dong's patch.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-09-24 17:26:51 +02:00 committed by Alexandre Julliard
parent ebe3fe536c
commit f3b8ccb2f7
1 changed files with 2 additions and 2 deletions

View File

@ -2168,9 +2168,9 @@ static NTSTATUS fill_output( struct screen_buffer *screen_buffer, const struct c
TRACE( "(%u %u) mode %u\n", params->x, params->y, params->mode );
dest = screen_buffer->data + params->y * screen_buffer->width + params->x;
if (params->y >= screen_buffer->height) return STATUS_SUCCESS;
dest = screen_buffer->data + min( params->y * screen_buffer->width + params->x,
screen_buffer->height * screen_buffer->width );
if (params->wrap)
end = screen_buffer->data + screen_buffer->height * screen_buffer->width;