summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/avahi/files/CVE-2023-38470-1.patch
blob: 82fb1ab40bdd33e0d824f5735221e23cc46e6029 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From 94cb6489114636940ac683515417990b55b5d66c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
Date: Tue, 11 Apr 2023 15:29:59 +0200
Subject: [PATCH] Ensure each label is at least one byte long

The only allowed exception is single dot, where it should return empty
string.

Fixes #454.

Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/avahi/tree/debian/patches/CVE-2023-38470-1.patch?h=ubuntu/focal-security
Upstream commit https://github.com/lathiat/avahi/commit/94cb6489114636940ac683515417990b55b5d66c]
CVE: CVE-2023-38470
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
 avahi-common/domain-test.c | 14 ++++++++++++++
 avahi-common/domain.c      |  2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)

Index: avahi-0.7/avahi-common/domain-test.c
===================================================================
--- avahi-0.7.orig/avahi-common/domain-test.c
+++ avahi-0.7/avahi-common/domain-test.c
@@ -45,6 +45,20 @@ int main(AVAHI_GCC_UNUSED int argc, AVAH
     printf("%s\n", s = avahi_normalize_name_strdup("fo\\\\o\\..f oo."));
     avahi_free(s);
 
+    printf("%s\n", s = avahi_normalize_name_strdup("."));
+    avahi_free(s);
+
+    s = avahi_normalize_name_strdup(",.=.}.=.?-.}.=.?.?.}.}.?.?.?.z.?.?.}.}."
+		    "}.?.?.?.r.=.=.}.=.?.}}.}.?.?.?.zM.=.=.?.?.}.}.?.?.}.}.}"
+		    ".?.?.?.r.=.=.}.=.?.}}.}.?.?.?.zM.=.=.?.?.}.}.?.?.?.zM.?`"
+		    "?.}.}.}.?.?.?.r.=.?.}.=.?.?.}.?.?.?.}.=.?.?.}??.}.}.?.?."
+		    "?.z.?.?.}.}.}.?.?.?.r.=.=.}.=.?.}}.}.?.?.?.zM.?`?.}.}.}."
+		    "??.?.zM.?`?.}.}.}.?.?.?.r.=.?.}.=.?.?.}.?.?.?.}.=.?.?.}?"
+		    "?.}.}.?.?.?.z.?.?.}.}.}.?.?.?.r.=.=.}.=.?.}}.}.?.?.?.zM."
+		    "?`?.}.}.}.?.?.?.r.=.=.?.?`.?.?}.}.}.?.?.?.r.=.?.}.=.?.?."
+		    "}.?.?.?.}.=.?.?.}");
+    assert(s == NULL);
+
     printf("%i\n", avahi_domain_equal("\\065aa bbb\\.\\046cc.cc\\\\.dee.fff.", "Aaa BBB\\.\\.cc.cc\\\\.dee.fff"));
     printf("%i\n", avahi_domain_equal("A", "a"));
 
Index: avahi-0.7/avahi-common/domain.c
===================================================================
--- avahi-0.7.orig/avahi-common/domain.c
+++ avahi-0.7/avahi-common/domain.c
@@ -201,7 +201,7 @@ char *avahi_normalize_name(const char *s
         }
 
         if (!empty) {
-            if (size < 1)
+            if (size < 2)
                 return NULL;
 
             *(r++) = '.';