summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-3551.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-3551.patch')
-rw-r--r--meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-3551.patch64
1 files changed, 64 insertions, 0 deletions
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-3551.patch b/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-3551.patch
new file mode 100644
index 0000000000..a3b977aac9
--- /dev/null
+++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg/CVE-2022-3551.patch
@@ -0,0 +1,64 @@
1From d3787290f56165f5656ddd2123dbf676a32d0a68 Mon Sep 17 00:00:00 2001
2From: Peter Hutterer <peter.hutterer@who-t.net>
3Date: Sun, 4 Dec 2022 17:44:00 +0000
4Subject: [PATCH 2/3] xkb: fix some possible memleaks in XkbGetKbdByName
5
6GetComponentByName returns an allocated string, so let's free that if we
7fail somewhere.
8
9Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10
11Upstream-Status: Backport [https://cgit.freedesktop.org/xorg/xserver/commit/?id=18f91b950e22c2a342a4fbc55e9ddf7534a707d2]
12CVE: CVE-2022-3551
13Signed-off-by:Minjae Kim <flowergom@gmail.com>
14
15---
16 xkb/xkb.c | 26 +++++++++++++++++++-------
17 1 file changed, 19 insertions(+), 7 deletions(-)
18
19diff --git a/xkb/xkb.c b/xkb/xkb.c
20index bf8aaa3..f79d306 100644
21--- a/xkb/xkb.c
22+++ b/xkb/xkb.c
23@@ -5908,19 +5908,31 @@ ProcXkbGetKbdByName(ClientPtr client)
24 xkb = dev->key->xkbInfo->desc;
25 status = Success;
26 str = (unsigned char *) &stuff[1];
27- if (GetComponentSpec(&str, TRUE, &status)) /* keymap, unsupported */
28- return BadMatch;
29+ {
30+ char *keymap = GetComponentSpec(&str, TRUE, &status); /* keymap, unsupported */
31+ if (keymap) {
32+ free(keymap);
33+ return BadMatch;
34+ }
35+ }
36 names.keycodes = GetComponentSpec(&str, TRUE, &status);
37 names.types = GetComponentSpec(&str, TRUE, &status);
38 names.compat = GetComponentSpec(&str, TRUE, &status);
39 names.symbols = GetComponentSpec(&str, TRUE, &status);
40 names.geometry = GetComponentSpec(&str, TRUE, &status);
41- if (status != Success)
42- return status;
43- len = str - ((unsigned char *) stuff);
44- if ((XkbPaddedSize(len) / 4) != stuff->length)
45- return BadLength;
46+ if (status == Success) {
47+ len = str - ((unsigned char *) stuff);
48+ if ((XkbPaddedSize(len) / 4) != stuff->length)
49+ status = BadLength;
50+ }
51
52+ if (status != Success) {
53+ free(names.keycodes);
54+ free(names.types);
55+ free(names.compat);
56+ free(names.symbols);
57+ free(names.geometry);
58+ }
59 CHK_MASK_LEGAL(0x01, stuff->want, XkbGBN_AllComponentsMask);
60 CHK_MASK_LEGAL(0x02, stuff->need, XkbGBN_AllComponentsMask);
61
62--
632.17.1
64