summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-core/dbus/dbus/0001-dbus-marshal-validate-Validate-length-of-arrays-of-f.patch61
-rw-r--r--meta/recipes-core/dbus/dbus_1.14.0.bb1
2 files changed, 62 insertions, 0 deletions
diff --git a/meta/recipes-core/dbus/dbus/0001-dbus-marshal-validate-Validate-length-of-arrays-of-f.patch b/meta/recipes-core/dbus/dbus/0001-dbus-marshal-validate-Validate-length-of-arrays-of-f.patch
new file mode 100644
index 0000000000..f953326f78
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus/0001-dbus-marshal-validate-Validate-length-of-arrays-of-f.patch
@@ -0,0 +1,61 @@
1From b9e6a7523085a2cfceaffca7ba1ab4251f12a984 Mon Sep 17 00:00:00 2001
2From: Simon McVittie <smcv@collabora.com>
3Date: Mon, 12 Sep 2022 13:14:18 +0100
4Subject: [PATCH] dbus-marshal-validate: Validate length of arrays of
5 fixed-length items
6
7This fast-path previously did not check that the array was made up
8of an integer number of items. This could lead to assertion failures
9and out-of-bounds accesses during subsequent message processing (which
10assumes that the message has already been validated), particularly after
11the addition of _dbus_header_remove_unknown_fields(), which makes it
12more likely that dbus-daemon will apply non-trivial edits to messages.
13
14Thanks: Evgeny Vereshchagin
15Fixes: e61f13cf "Bug 18064 - more efficient validation for fixed-size type arrays"
16Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/413
17Resolves: CVE-2022-42011
18
19Upstream-Status: Backport from
20[https://gitlab.freedesktop.org/dbus/dbus/-/commit/b9e6a7523085a2cfceaffca7ba1ab4251f12a984]
21
22Signed-off-by: Simon McVittie <smcv@collabora.com>
23(cherry picked from commit 079bbf16186e87fb0157adf8951f19864bc2ed69)
24Signed-off-by: Xiangyu Chen <xiangyu.chen@eng.windriver.com>
25---
26 dbus/dbus-marshal-validate.c | 13 ++++++++++++-
27 1 file changed, 12 insertions(+), 1 deletion(-)
28
29diff --git a/dbus/dbus-marshal-validate.c b/dbus/dbus-marshal-validate.c
30index ae68414d..7d0d6cf7 100644
31--- a/dbus/dbus-marshal-validate.c
32+++ b/dbus/dbus-marshal-validate.c
33@@ -503,13 +503,24 @@ validate_body_helper (DBusTypeReader *reader,
34 */
35 if (dbus_type_is_fixed (array_elem_type))
36 {
37+ /* Note that fixed-size types all have sizes equal to
38+ * their alignments, so this is really the item size. */
39+ alignment = _dbus_type_get_alignment (array_elem_type);
40+ _dbus_assert (alignment == 1 || alignment == 2 ||
41+ alignment == 4 || alignment == 8);
42+
43+ /* Because the alignment is a power of 2, this is
44+ * equivalent to: (claimed_len % alignment) != 0,
45+ * but avoids slower integer division */
46+ if ((claimed_len & (alignment - 1)) != 0)
47+ return DBUS_INVALID_ARRAY_LENGTH_INCORRECT;
48+
49 /* bools need to be handled differently, because they can
50 * have an invalid value
51 */
52 if (array_elem_type == DBUS_TYPE_BOOLEAN)
53 {
54 dbus_uint32_t v;
55- alignment = _dbus_type_get_alignment (array_elem_type);
56
57 while (p < array_end)
58 {
59--
602.34.1
61
diff --git a/meta/recipes-core/dbus/dbus_1.14.0.bb b/meta/recipes-core/dbus/dbus_1.14.0.bb
index 4577da782c..e1efa9e058 100644
--- a/meta/recipes-core/dbus/dbus_1.14.0.bb
+++ b/meta/recipes-core/dbus/dbus_1.14.0.bb
@@ -14,6 +14,7 @@ SRC_URI = "https://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.xz \
14 file://tmpdir.patch \ 14 file://tmpdir.patch \
15 file://dbus-1.init \ 15 file://dbus-1.init \
16 file://0001-dbus-marshal-validate-Check-brackets-in-signature-ne.patch \ 16 file://0001-dbus-marshal-validate-Check-brackets-in-signature-ne.patch \
17 file://0001-dbus-marshal-validate-Validate-length-of-arrays-of-f.patch \
17" 18"
18 19
19SRC_URI[sha256sum] = "ccd7cce37596e0a19558fd6648d1272ab43f011d80c8635aea8fd0bad58aebd4" 20SRC_URI[sha256sum] = "ccd7cce37596e0a19558fd6648d1272ab43f011d80c8635aea8fd0bad58aebd4"