Fix byte-swapping of Motif DND tables
* src/xterm.c (xm_read_targets_table_rec): Swap nitems first before checking the length.
This commit is contained in:
parent
61bdad4685
commit
b2b939e5a1
1 changed files with 3 additions and 3 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue