|
| 1 | +From cc5f44eb015384d8c764646c48b9da80f811446c Mon Sep 17 00:00:00 2001 |
| 2 | +From: Kanishk-Bansal <kbkanishk975@gmail.com> |
| 3 | +Date: Mon, 2 Dec 2024 10:25:43 +0000 |
| 4 | +Subject: [PATCH] Fix CVE-2023-38470 |
| 5 | + |
| 6 | +--- |
| 7 | + avahi-common/domain-test.c | 14 ++++++++++++++ |
| 8 | + avahi-common/domain.c | 2 +- |
| 9 | + 2 files changed, 15 insertions(+), 1 deletion(-) |
| 10 | + |
| 11 | +diff --git a/avahi-common/domain-test.c b/avahi-common/domain-test.c |
| 12 | +index cf763ec..3acc1c1 100644 |
| 13 | +--- a/avahi-common/domain-test.c |
| 14 | ++++ b/avahi-common/domain-test.c |
| 15 | +@@ -45,6 +45,20 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { |
| 16 | + printf("%s\n", s = avahi_normalize_name_strdup("fo\\\\o\\..f oo.")); |
| 17 | + avahi_free(s); |
| 18 | + |
| 19 | ++ printf("%s\n", s = avahi_normalize_name_strdup(".")); |
| 20 | ++ avahi_free(s); |
| 21 | ++ |
| 22 | ++ s = avahi_normalize_name_strdup(",.=.}.=.?-.}.=.?.?.}.}.?.?.?.z.?.?.}.}." |
| 23 | ++ "}.?.?.?.r.=.=.}.=.?.}}.}.?.?.?.zM.=.=.?.?.}.}.?.?.}.}.}" |
| 24 | ++ ".?.?.?.r.=.=.}.=.?.}}.}.?.?.?.zM.=.=.?.?.}.}.?.?.?.zM.?`" |
| 25 | ++ "?.}.}.}.?.?.?.r.=.?.}.=.?.?.}.?.?.?.}.=.?.?.}??.}.}.?.?." |
| 26 | ++ "?.z.?.?.}.}.}.?.?.?.r.=.=.}.=.?.}}.}.?.?.?.zM.?`?.}.}.}." |
| 27 | ++ "??.?.zM.?`?.}.}.}.?.?.?.r.=.?.}.=.?.?.}.?.?.?.}.=.?.?.}?" |
| 28 | ++ "?.}.}.?.?.?.z.?.?.}.}.}.?.?.?.r.=.=.}.=.?.}}.}.?.?.?.zM." |
| 29 | ++ "?`?.}.}.}.?.?.?.r.=.=.?.?`.?.?}.}.}.?.?.?.r.=.?.}.=.?.?." |
| 30 | ++ "}.?.?.?.}.=.?.?.}"); |
| 31 | ++ assert(s == NULL); |
| 32 | ++ |
| 33 | + printf("%i\n", avahi_domain_equal("\\065aa bbb\\.\\046cc.cc\\\\.dee.fff.", "Aaa BBB\\.\\.cc.cc\\\\.dee.fff")); |
| 34 | + printf("%i\n", avahi_domain_equal("A", "a")); |
| 35 | + |
| 36 | +diff --git a/avahi-common/domain.c b/avahi-common/domain.c |
| 37 | +index 3b1ab68..e66d241 100644 |
| 38 | +--- a/avahi-common/domain.c |
| 39 | ++++ b/avahi-common/domain.c |
| 40 | +@@ -201,7 +201,7 @@ char *avahi_normalize_name(const char *s, char *ret_s, size_t size) { |
| 41 | + } |
| 42 | + |
| 43 | + if (!empty) { |
| 44 | +- if (size < 1) |
| 45 | ++ if (size < 2) |
| 46 | + return NULL; |
| 47 | + |
| 48 | + *(r++) = '.'; |
| 49 | +-- |
| 50 | +2.45.2 |
| 51 | + |
0 commit comments