wok-current view xorg-server/stuff/CVE-2022-3551.patch @ rev 25634
Mass update, new toolchain gcc 8.3.0, glibc 2.28.0
author | Stanislas Leduc <shann@slitaz.org> |
---|---|
date | Sun Jan 14 08:12:37 2024 +0000 (20 months ago) |
parents | |
children |
line source
1 From 18f91b950e22c2a342a4fbc55e9ddf7534a707d2 Mon Sep 17 00:00:00 2001
2 From: Peter Hutterer <peter.hutterer@who-t.net>
3 Date: Wed, 13 Jul 2022 11:23:09 +1000
4 Subject: xkb: fix some possible memleaks in XkbGetKbdByName
6 GetComponentByName returns an allocated string, so let's free that if we
7 fail somewhere.
9 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 ---
11 xkb/xkb.c | 26 ++++++++++++++++++++------
12 1 file changed, 20 insertions(+), 6 deletions(-)
14 diff --git a/xkb/xkb.c b/xkb/xkb.c
15 index 4692895db..b79a269e3 100644
16 --- a/xkb/xkb.c
17 +++ b/xkb/xkb.c
18 @@ -5935,18 +5935,32 @@ ProcXkbGetKbdByName(ClientPtr client)
19 xkb = dev->key->xkbInfo->desc;
20 status = Success;
21 str = (unsigned char *) &stuff[1];
22 - if (GetComponentSpec(&str, TRUE, &status)) /* keymap, unsupported */
23 - return BadMatch;
24 + {
25 + char *keymap = GetComponentSpec(&str, TRUE, &status); /* keymap, unsupported */
26 + if (keymap) {
27 + free(keymap);
28 + return BadMatch;
29 + }
30 + }
31 names.keycodes = GetComponentSpec(&str, TRUE, &status);
32 names.types = GetComponentSpec(&str, TRUE, &status);
33 names.compat = GetComponentSpec(&str, TRUE, &status);
34 names.symbols = GetComponentSpec(&str, TRUE, &status);
35 names.geometry = GetComponentSpec(&str, TRUE, &status);
36 - if (status != Success)
37 + if (status == Success) {
38 + len = str - ((unsigned char *) stuff);
39 + if ((XkbPaddedSize(len) / 4) != stuff->length)
40 + status = BadLength;
41 + }
42 +
43 + if (status != Success) {
44 + free(names.keycodes);
45 + free(names.types);
46 + free(names.compat);
47 + free(names.symbols);
48 + free(names.geometry);
49 return status;
50 - len = str - ((unsigned char *) stuff);
51 - if ((XkbPaddedSize(len) / 4) != stuff->length)
52 - return BadLength;
53 + }
55 CHK_MASK_LEGAL(0x01, stuff->want, XkbGBN_AllComponentsMask);
56 CHK_MASK_LEGAL(0x02, stuff->need, XkbGBN_AllComponentsMask);
57 --
58 cgit v1.2.1