emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master b2b939e5a1: Fix byte-swapping of Motif DND tables


From: Po Lu
Subject: master b2b939e5a1: Fix byte-swapping of Motif DND tables
Date: Thu, 16 Jun 2022 03:31:35 -0400 (EDT)

branch: master
commit b2b939e5a10aa9b61ac1f73e297fb94f50b86f5b
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix byte-swapping of Motif DND tables
    
    * src/xterm.c (xm_read_targets_table_rec): Swap nitems first
    before checking the length.
---
 src/xterm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 04e3223478..45c96c5106 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1663,12 +1663,12 @@ xm_read_targets_table_rec (uint8_t *bytes, ptrdiff_t 
length,
 
   nitems = *(uint16_t *) bytes;
 
-  if (length < 2 + nitems * 4)
-    return NULL;
-
   if (byteorder != XM_BYTE_ORDER_CUR_FIRST)
     SWAPCARD16 (nitems);
 
+  if (length < 2 + nitems * 4)
+    return NULL;
+
   rec = xmalloc (FLEXSIZEOF (struct xm_targets_table_rec,
                             targets, nitems * 4));
   rec->n_targets = nitems;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]