Skip to content

Commit ce24d79

Browse files
committed
xkb: Fix buffer overflow in _XkbSetCompatMap()
Fixes #1085 (CVE-2024-9632) Backport of this xorg-xserver upstream commit: commit 85b776571487f52e756f68a069c768757369bfe3 Author: Matthieu Herrb <[email protected]> Date: Thu Oct 10 10:37:28 2024 +0200 xkb: Fix buffer overflow in _XkbSetCompatMap() The _XkbSetCompatMap() function attempts to resize the `sym_interpret` buffer. However, It didn't update its size properly. It updated `num_si` only, without updating `size_si`. This may lead to local privilege escalation if the server is run as root or remote code execution (e.g. x11 over ssh). CVE-2024-9632, ZDI-CAN-24756 This vulnerability was discovered by: Jan-Niklas Sohn working with Trend Micro Zero Day Initiative Reviewed-by: Peter Hutterer <[email protected]> Tested-by: Peter Hutterer <[email protected]> Reviewed-by: José Expósito <[email protected]> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1733>
1 parent 58d42b6 commit ce24d79

File tree

1 file changed

+4
-4
lines changed
  • nx-X11/programs/Xserver/xkb

1 file changed

+4
-4
lines changed

nx-X11/programs/Xserver/xkb/xkb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2565,13 +2565,13 @@ ProcXkbSetCompatMap(ClientPtr client)
25652565
if (stuff->nSI>0) {
25662566
xkbSymInterpretWireDesc *wire = (xkbSymInterpretWireDesc *)data;
25672567
XkbSymInterpretPtr sym;
2568-
if ((unsigned)(stuff->firstSI+stuff->nSI)>compat->num_si) {
2569-
compat->num_si= stuff->firstSI+stuff->nSI;
2568+
if ((unsigned) (stuff->firstSI + stuff->nSI) > compat->size_si) {
2569+
compat->num_si= compat->size_si = stuff->firstSI + stuff->nSI;
25702570
compat->sym_interpret= _XkbTypedRealloc(compat->sym_interpret,
2571-
compat->num_si,
2571+
compat->size_si,
25722572
XkbSymInterpretRec);
25732573
if (!compat->sym_interpret) {
2574-
compat->num_si= 0;
2574+
compat->num_si = compat->size_si = 0;
25752575
return BadAlloc;
25762576
}
25772577
}

0 commit comments

Comments
 (0)