From 73df958411e2b1c55f3e91b1ed747de0b2bcd59d Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sun, 22 May 2022 15:56:11 +0800 Subject: [PATCH] Fix uninitialized use of xm drag receiver data * src/xterm.c (xm_read_drag_receiver_info): Just return if the protocol is invalid. Reported by Jashank Jeremy . --- src/xterm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index c6c0a2f9153..60c17f03719 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1995,6 +1995,9 @@ xm_read_drag_receiver_info (struct x_display_info *dpyinfo, { data = (uint8_t *) tmp_data; + if (data[1] > XM_DRAG_PROTOCOL_VERSION) + return 1; + rec->byteorder = data[0]; rec->protocol = data[1]; rec->protocol_style = data[2]; @@ -2013,9 +2016,6 @@ xm_read_drag_receiver_info (struct x_display_info *dpyinfo, rec->byteorder = XM_BYTE_ORDER_CUR_FIRST; } - if (data[1] > XM_DRAG_PROTOCOL_VERSION) - rc = 0; - if (tmp_data) XFree (tmp_data); -- 2.39.2