]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix uninitialized use of xm drag receiver data
authorPo Lu <luangruo@yahoo.com>
Sun, 22 May 2022 07:56:11 +0000 (15:56 +0800)
committerPo Lu <luangruo@yahoo.com>
Sun, 22 May 2022 07:56:20 +0000 (15:56 +0800)
* src/xterm.c (xm_read_drag_receiver_info): Just return if the
protocol is invalid.  Reported by Jashank Jeremy
<jashank@rulingia.com.au>.

src/xterm.c

index c6c0a2f9153e538c8ccccc3020c4b7a923537635..60c17f03719820be38d572b1ad2a59de9598e563 100644 (file)
@@ -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);