conhost: Validate width param in write_output.

Signed-off-by: Pengpeng Dong <dongpengpeng@uniontech.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Pengpeng Dong 2020-09-23 15:04:39 +02:00 committed by Alexandre Julliard
parent d22e821964
commit b9f1ec8c44
1 changed files with 2 additions and 0 deletions

View File

@ -1984,6 +1984,8 @@ static NTSTATUS write_output( struct screen_buffer *screen_buffer, const struct
char_info_t *dest;
char *src;
if (*out_size == sizeof(SMALL_RECT) && !params->width) return STATUS_INVALID_PARAMETER;
entry_size = params->mode == CHAR_INFO_MODE_TEXTATTR ? sizeof(char_info_t) : sizeof(WCHAR);
entry_cnt = (in_size - sizeof(*params)) / entry_size;