From: Po Lu Date: Thu, 16 Jun 2022 07:26:55 +0000 (+0800) Subject: Fix byte-swapping of Motif DND tables X-Git-Tag: emacs-29.0.90~1447^2~1718 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b2b939e5a10aa9b61ac1f73e297fb94f50b86f5b;p=emacs.git Fix byte-swapping of Motif DND tables * src/xterm.c (xm_read_targets_table_rec): Swap nitems first before checking the length. --- 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;