summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMeenali Gupta <meenali.gupta@windriver.com>2023-11-16 10:39:57 +0000
committerSteve Sakoman <steve@sakoman.com>2023-11-28 05:00:32 -1000
commit2629c5fe89229901db08f52e579b1b1caede9b5b (patch)
treeac6597398432d7202d896b7aff26b94b8f58f187
parent517e5132095664efdac617fdffc88f65116026cc (diff)
downloadpoky-2629c5fe89229901db08f52e579b1b1caede9b5b.tar.gz
avahi: fix CVE-2023-38473
A vulnerability was found in Avahi. A reachable assertion exists in the avahi_alternative_host_name() function. (From OE-Core rev: 3a9b67f222d6e004a8b56eedca6ff869e9aba710) Signed-off-by: Meenali Gupta <meenali.gupta@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-connectivity/avahi/avahi_0.8.bb1
-rw-r--r--meta/recipes-connectivity/avahi/files/CVE-2023-38473.patch108
2 files changed, 109 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/avahi/avahi_0.8.bb b/meta/recipes-connectivity/avahi/avahi_0.8.bb
index 23801a7e54..af5284a252 100644
--- a/meta/recipes-connectivity/avahi/avahi_0.8.bb
+++ b/meta/recipes-connectivity/avahi/avahi_0.8.bb
@@ -30,6 +30,7 @@ SRC_URI = "https://github.com/lathiat/avahi/releases/download/v${PV}/avahi-${PV}
30 file://CVE-2023-38470.patch \ 30 file://CVE-2023-38470.patch \
31 file://CVE-2023-38469.patch \ 31 file://CVE-2023-38469.patch \
32 file://CVE-2023-38472.patch \ 32 file://CVE-2023-38472.patch \
33 file://CVE-2023-38473.patch \
33 " 34 "
34 35
35UPSTREAM_CHECK_URI = "https://github.com/lathiat/avahi/releases/" 36UPSTREAM_CHECK_URI = "https://github.com/lathiat/avahi/releases/"
diff --git a/meta/recipes-connectivity/avahi/files/CVE-2023-38473.patch b/meta/recipes-connectivity/avahi/files/CVE-2023-38473.patch
new file mode 100644
index 0000000000..8a372a072a
--- /dev/null
+++ b/meta/recipes-connectivity/avahi/files/CVE-2023-38473.patch
@@ -0,0 +1,108 @@
1From b448c9f771bada14ae8de175695a9729f8646797 Mon Sep 17 00:00:00 2001
2From: Michal Sekletar <msekleta@redhat.com>
3Date: Wed, 11 Oct 2023 17:45:44 +0200
4Subject: [PATCH]common: derive alternative host name from its
5 unescaped version
6
7Normalization of input makes sure we don't have to deal with special
8cases like unescaped dot at the end of label.
9
10Upstream-Status: Backport [https://github.com/lathiat/avahi/commit/b448c9f771bada14ae8de175695a9729f8646797]
11CVE: CVE-2023-38473
12
13Signed-off-by: Meenali Gupta <meenali.gupta@windriver.com>
14---
15 avahi-common/alternative-test.c | 3 +++
16 avahi-common/alternative.c | 27 +++++++++++++++++++--------
17 2 files changed, 22 insertions(+), 8 deletions(-)
18
19diff --git a/avahi-common/alternative-test.c b/avahi-common/alternative-test.c
20index 9255435..681fc15 100644
21--- a/avahi-common/alternative-test.c
22+++ b/avahi-common/alternative-test.c
23@@ -31,6 +31,9 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
24 const char* const test_strings[] = {
25 "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
26 "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXüüüüüüü",
27+ ").",
28+ "\\.",
29+ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\",
30 "gurke",
31 "-",
32 " #",
33diff --git a/avahi-common/alternative.c b/avahi-common/alternative.c
34index b3d39f0..a094e6d 100644
35--- a/avahi-common/alternative.c
36+++ b/avahi-common/alternative.c
37@@ -49,15 +49,20 @@ static void drop_incomplete_utf8(char *c) {
38 }
39
40 char *avahi_alternative_host_name(const char *s) {
41+ char label[AVAHI_LABEL_MAX], alternative[AVAHI_LABEL_MAX*4+1];
42+ char *alt, *r, *ret;
43 const char *e;
44- char *r;
45+ size_t len;
46
47 assert(s);
48
49 if (!avahi_is_valid_host_name(s))
50 return NULL;
51
52- if ((e = strrchr(s, '-'))) {
53+ if (!avahi_unescape_label(&s, label, sizeof(label)))
54+ return NULL;
55+
56+ if ((e = strrchr(label, '-'))) {
57 const char *p;
58
59 e++;
60@@ -74,19 +79,18 @@ char *avahi_alternative_host_name(const char *s) {
61
62 if (e) {
63 char *c, *m;
64- size_t l;
65 int n;
66
67 n = atoi(e)+1;
68 if (!(m = avahi_strdup_printf("%i", n)))
69 return NULL;
70
71- l = e-s-1;
72+ len = e-label-1;
73
74- if (l >= AVAHI_LABEL_MAX-1-strlen(m)-1)
75- l = AVAHI_LABEL_MAX-1-strlen(m)-1;
76+ if (len >= AVAHI_LABEL_MAX-1-strlen(m)-1)
77+ len = AVAHI_LABEL_MAX-1-strlen(m)-1;
78
79- if (!(c = avahi_strndup(s, l))) {
80+ if (!(c = avahi_strndup(label, len))) {
81 avahi_free(m);
82 return NULL;
83 }
84@@ -100,7 +104,7 @@ char *avahi_alternative_host_name(const char *s) {
85 } else {
86 char *c;
87
88- if (!(c = avahi_strndup(s, AVAHI_LABEL_MAX-1-2)))
89+ if (!(c = avahi_strndup(label, AVAHI_LABEL_MAX-1-2)))
90 return NULL;
91
92 drop_incomplete_utf8(c);
93@@ -109,6 +113,13 @@ char *avahi_alternative_host_name(const char *s) {
94 avahi_free(c);
95 }
96
97+ alt = alternative;
98+ len = sizeof(alternative);
99+ ret = avahi_escape_label(r, strlen(r), &alt, &len);
100+
101+ avahi_free(r);
102+ r = avahi_strdup(ret);
103+
104 assert(avahi_is_valid_host_name(r));
105
106 return r;
107--
1082.40.0