mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2026-10-24 00:49:00 +03:00
Fix out-of-bounds write in the byte-swap routine of _xdg_mime_magic_parse_magic_line(). On little-endian systems, the write side of the swap casts the base pointer to a wider type before adding the byte offset, causing pointer arithmetic to scale by sizeof(type) instead of 1. With value_length=4 and word_size=2, the loop writes 2 bytes past the allocated matchlet->value buffer at i=2. Parenthesize (ptr + i) before the cast so both the read and write sides use byte offsets. Upstream: https://gitlab.freedesktop.org/xdg/xdgmime/-/work_items/41