[PATCH 1/2] server: Zero-initialize rawinput_message structures before passing them to queue_rawinput_message() (Valgrind).
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> --- server/queue.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/server/queue.c b/server/queue.c index 0a29c8787c3..b6024dc22b5 100644 --- a/server/queue.c +++ b/server/queue.c @@ -1818,12 +1818,12 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons if ((foreground = get_foreground_thread( desktop, win ))) { + memset( &raw_msg, 0, sizeof(raw_msg) ); raw_msg.foreground = foreground; raw_msg.desktop = desktop; raw_msg.source = source; raw_msg.time = time; raw_msg.message = WM_INPUT; - raw_msg.hid_report = NULL; msg_data = &raw_msg.data; msg_data->info = input->mouse.info; @@ -1955,12 +1955,12 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c if ((foreground = get_foreground_thread( desktop, win ))) { + memset( &raw_msg, 0, sizeof(raw_msg) ); raw_msg.foreground = foreground; raw_msg.desktop = desktop; raw_msg.source = source; raw_msg.time = time; raw_msg.message = WM_INPUT; - raw_msg.hid_report = NULL; msg_data = &raw_msg.data; msg_data->info = input->kbd.info; @@ -2026,12 +2026,10 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ { case WM_INPUT: case WM_INPUT_DEVICE_CHANGE: - raw_msg.foreground = NULL; - raw_msg.desktop = NULL; + memset( &raw_msg, 0, sizeof(raw_msg) ); raw_msg.source = source; raw_msg.time = get_tick_count(); raw_msg.message = input->hw.msg; - raw_msg.hid_report = NULL; if (input->hw.rawinput.type == RIM_TYPEHID) { @@ -2046,9 +2044,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ } msg_data = &raw_msg.data; - msg_data->info = 0; msg_data->size = sizeof(*msg_data) + report_size; - msg_data->flags = 0; msg_data->rawinput = input->hw.rawinput; enum_processes( queue_rawinput_message, &raw_msg ); -- 2.33.0
Fixes: 567beb6b2edba07051a75d45a9b2f1516568c0e7 Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> --- server/sock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/sock.c b/server/sock.c index 42f73e52fa2..cebed94aec4 100644 --- a/server/sock.c +++ b/server/sock.c @@ -839,6 +839,7 @@ static int get_poll_flags( struct sock *sock, int event ) static void complete_async_poll( struct poll_req *req, unsigned int status ) { + struct poll_socket_output *output = req->output; unsigned int i; for (i = 0; i < req->count; ++i) @@ -850,8 +851,8 @@ static void complete_async_poll( struct poll_req *req, unsigned int status ) } /* pass 0 as result; client will set actual result size */ - async_request_complete( req->async, status, 0, req->count * sizeof(*req->output), req->output ); req->output = NULL; + async_request_complete( req->async, status, 0, req->count * sizeof(*output), output ); } static void complete_async_polls( struct sock *sock, int event, int error ) -- 2.33.0
participants (1)
-
Zebediah Figura