diff options
Diffstat (limited to 'meta/recipes-connectivity/bluez5/bluez5/CVE-2022-39176.patch')
-rw-r--r-- | meta/recipes-connectivity/bluez5/bluez5/CVE-2022-39176.patch | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/bluez5/bluez5/CVE-2022-39176.patch b/meta/recipes-connectivity/bluez5/bluez5/CVE-2022-39176.patch new file mode 100644 index 0000000000..7bd1f5f80f --- /dev/null +++ b/meta/recipes-connectivity/bluez5/bluez5/CVE-2022-39176.patch | |||
@@ -0,0 +1,126 @@ | |||
1 | From 752c7f707c3cc1eb12eadc13bc336a5c484d4bdf Mon Sep 17 00:00:00 2001 | ||
2 | From: Hitendra Prajapati <hprajapati@mvista.com> | ||
3 | Date: Wed, 28 Sep 2022 10:45:53 +0530 | ||
4 | Subject: [PATCH] CVE-2022-39176 | ||
5 | |||
6 | Upstream-Status: Backport [https://launchpad.net/ubuntu/+source/bluez/5.53-0ubuntu3.6] | ||
7 | CVE: CVE-2022-39176 | ||
8 | Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com> | ||
9 | --- | ||
10 | profiles/audio/avdtp.c | 56 +++++++++++++++++++++++++++--------------- | ||
11 | profiles/audio/avrcp.c | 8 ++++++ | ||
12 | 2 files changed, 44 insertions(+), 20 deletions(-) | ||
13 | |||
14 | diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c | ||
15 | index 782268c..0adf413 100644 | ||
16 | --- a/profiles/audio/avdtp.c | ||
17 | +++ b/profiles/audio/avdtp.c | ||
18 | @@ -1261,43 +1261,53 @@ struct avdtp_remote_sep *avdtp_find_remote_sep(struct avdtp *session, | ||
19 | return NULL; | ||
20 | } | ||
21 | |||
22 | -static GSList *caps_to_list(uint8_t *data, int size, | ||
23 | +static GSList *caps_to_list(uint8_t *data, size_t size, | ||
24 | struct avdtp_service_capability **codec, | ||
25 | gboolean *delay_reporting) | ||
26 | { | ||
27 | + struct avdtp_service_capability *cap; | ||
28 | GSList *caps; | ||
29 | - int processed; | ||
30 | |||
31 | if (delay_reporting) | ||
32 | *delay_reporting = FALSE; | ||
33 | |||
34 | - for (processed = 0, caps = NULL; processed + 2 <= size;) { | ||
35 | - struct avdtp_service_capability *cap; | ||
36 | - uint8_t length, category; | ||
37 | + if (size < sizeof(*cap)) | ||
38 | + return NULL; | ||
39 | + | ||
40 | + for (caps = NULL; size >= sizeof(*cap);) { | ||
41 | + struct avdtp_service_capability *cpy; | ||
42 | |||
43 | - category = data[0]; | ||
44 | - length = data[1]; | ||
45 | + cap = (struct avdtp_service_capability *)data; | ||
46 | |||
47 | - if (processed + 2 + length > size) { | ||
48 | + if (sizeof(*cap) + cap->length > size) { | ||
49 | error("Invalid capability data in getcap resp"); | ||
50 | break; | ||
51 | } | ||
52 | |||
53 | - cap = g_malloc(sizeof(struct avdtp_service_capability) + | ||
54 | - length); | ||
55 | - memcpy(cap, data, 2 + length); | ||
56 | + if (cap->category == AVDTP_MEDIA_CODEC && | ||
57 | + cap->length < sizeof(**codec)) { | ||
58 | + error("Invalid codec data in getcap resp"); | ||
59 | + break; | ||
60 | + } | ||
61 | + | ||
62 | + cpy = btd_malloc(sizeof(*cpy) + cap->length); | ||
63 | + memcpy(cpy, cap, sizeof(*cap) + cap->length); | ||
64 | |||
65 | - processed += 2 + length; | ||
66 | - data += 2 + length; | ||
67 | + size -= sizeof(*cap) + cap->length; | ||
68 | + data += sizeof(*cap) + cap->length; | ||
69 | |||
70 | - caps = g_slist_append(caps, cap); | ||
71 | + caps = g_slist_append(caps, cpy); | ||
72 | |||
73 | - if (category == AVDTP_MEDIA_CODEC && | ||
74 | - length >= | ||
75 | - sizeof(struct avdtp_media_codec_capability)) | ||
76 | - *codec = cap; | ||
77 | - else if (category == AVDTP_DELAY_REPORTING && delay_reporting) | ||
78 | - *delay_reporting = TRUE; | ||
79 | + switch (cap->category) { | ||
80 | + case AVDTP_MEDIA_CODEC: | ||
81 | + if (codec) | ||
82 | + *codec = cpy; | ||
83 | + break; | ||
84 | + case AVDTP_DELAY_REPORTING: | ||
85 | + if (delay_reporting) | ||
86 | + *delay_reporting = TRUE; | ||
87 | + break; | ||
88 | + } | ||
89 | } | ||
90 | |||
91 | return caps; | ||
92 | @@ -1494,6 +1504,12 @@ static gboolean avdtp_setconf_cmd(struct avdtp *session, uint8_t transaction, | ||
93 | &stream->codec, | ||
94 | &stream->delay_reporting); | ||
95 | |||
96 | + if (!stream->caps || !stream->codec) { | ||
97 | + err = AVDTP_UNSUPPORTED_CONFIGURATION; | ||
98 | + category = 0x00; | ||
99 | + goto failed_stream; | ||
100 | + } | ||
101 | + | ||
102 | /* Verify that the Media Transport capability's length = 0. Reject otherwise */ | ||
103 | for (l = stream->caps; l != NULL; l = g_slist_next(l)) { | ||
104 | struct avdtp_service_capability *cap = l->data; | ||
105 | diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c | ||
106 | index d9471c0..0233d53 100644 | ||
107 | --- a/profiles/audio/avrcp.c | ||
108 | +++ b/profiles/audio/avrcp.c | ||
109 | @@ -1916,6 +1916,14 @@ static size_t handle_vendordep_pdu(struct avctp *conn, uint8_t transaction, | ||
110 | goto err_metadata; | ||
111 | } | ||
112 | |||
113 | + operands += sizeof(*pdu); | ||
114 | + operand_count -= sizeof(*pdu); | ||
115 | + | ||
116 | + if (pdu->params_len != operand_count) { | ||
117 | + DBG("AVRCP PDU parameters length don't match"); | ||
118 | + pdu->params_len = operand_count; | ||
119 | + } | ||
120 | + | ||
121 | for (handler = session->control_handlers; handler->pdu_id; handler++) { | ||
122 | if (handler->pdu_id == pdu->pdu_id) | ||
123 | break; | ||
124 | -- | ||
125 | 2.25.1 | ||
126 | |||