From 770a29f12885e618ee02ad5f76f88b8745f8c09d Mon Sep 17 00:00:00 2001 From: zppzhangpan Date: Mon, 16 Oct 2023 14:41:25 +0800 Subject: [PATCH] fix CVE-2023-38470 --- avahi.spec | 8 +++-- backport-CVE-2023-38470.patch | 56 +++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 backport-CVE-2023-38470.patch diff --git a/avahi.spec b/avahi.spec index d170df7..65e9300 100644 --- a/avahi.spec +++ b/avahi.spec @@ -3,7 +3,7 @@ Name: avahi Version: 0.8 -Release: 16 +Release: 17 Summary: Avahi is a local network service discovery License: LGPLv2+ URL: http://avahi.org @@ -19,7 +19,8 @@ Patch5: 0005-avahi_dns_packet_consume_uint32-fix-potential-undefi.patc Patch6001: backport-CVE-2021-3468.patch Patch6002: backport-CVE-2021-36217.patch -Patch6023: backport-CVE-2023-1981.patch +Patch6003: backport-CVE-2023-1981.patch +Patch6004: backport-CVE-2023-38470.patch BuildRequires: gcc automake libtool desktop-file-utils gtk2-devel glib2-devel gcc-c++ BuildRequires: libcap-devel expat-devel gdbm-devel make @@ -579,6 +580,9 @@ fi %{_mandir}/man8/* %changelog +* Mon Oct 16 2023 zhangpan - 0.8-17 +- fix CVE-2023-38470 + * Wed Apr 12 2023 zhouwenpei - 0.8-16 - fix CVE-2023-1981 diff --git a/backport-CVE-2023-38470.patch b/backport-CVE-2023-38470.patch new file mode 100644 index 0000000..4422b38 --- /dev/null +++ b/backport-CVE-2023-38470.patch @@ -0,0 +1,56 @@ +From 94cb6489114636940ac683515417990b55b5d66c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= +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. + +Reference:https://github.com/lathiat/avahi/commit/94cb6489114636940ac683515417990b55b5d66c +Conflict:NA + +--- + avahi-common/domain-test.c | 14 ++++++++++++++ + avahi-common/domain.c | 2 +- + 2 files changed, 15 insertions(+), 1 deletion(-) + +diff --git a/avahi-common/domain-test.c b/avahi-common/domain-test.c +index cf763eca6..3acc1c1e4 100644 +--- a/avahi-common/domain-test.c ++++ b/avahi-common/domain-test.c +@@ -45,6 +45,20 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { + 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")); + +diff --git a/avahi-common/domain.c b/avahi-common/domain.c +index 3b1ab6834..e66d2416c 100644 +--- a/avahi-common/domain.c ++++ b/avahi-common/domain.c +@@ -201,7 +201,7 @@ char *avahi_normalize_name(const char *s, char *ret_s, size_t size) { + } + + if (!empty) { +- if (size < 1) ++ if (size < 2) + return NULL; + + *(r++) = '.'; -- Gitee