From: Jacek Caban Subject: [PATCH] conhost: Validate width param in write_output. Message-Id: <1a91e6d0-dae5-8d08-9c72-c2f417276022@codeweavers.com> Date: Wed, 23 Sep 2020 15:04:39 +0200 From: Pengpeng Dong Signed-off-by: Pengpeng Dong Signed-off-by: Jacek Caban --- programs/conhost/conhost.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index 79cbb8e83a4..ed528385286 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -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;