!65 fix CVE-2023-38470

From: @zppzhangpan 
Reviewed-by: @t_feng 
Signed-off-by: @t_feng
This commit is contained in:
openeuler-ci-bot 2023-10-16 07:50:00 +00:00 committed by Gitee
commit bef9fa4be6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 62 additions and 2 deletions

View File

@ -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 <zhangpan103@h-partners.com> - 0.8-17
- fix CVE-2023-38470
* Wed Apr 12 2023 zhouwenpei <zhouwenpei1@h-partners.com> - 0.8-16
- fix CVE-2023-1981

View File

@ -0,0 +1,56 @@
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.
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++) = '.';