From b2b939e5a10aa9b61ac1f73e297fb94f50b86f5b Mon Sep 17 00:00:00 2001 From: Po Lu Date: Thu, 16 Jun 2022 15:26:55 +0800 Subject: [PATCH] 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 04e3223478f..45c96c51060 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; -- 2.39.2