Skip to content

Commit 07c7a6f

Browse files
authored
Avahi: Fix CVE-2023-1981, add %check section (#10882)
1 parent 29b2ed2 commit 07c7a6f

2 files changed

Lines changed: 62 additions & 1 deletion

File tree

SPECS/avahi/CVE-2023-1981.patch

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
From a2696da2f2c50ac43b6c4903f72290d5c3fa9f6f Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
3+
Date: Thu, 17 Nov 2022 01:51:53 +0100
4+
Subject: [PATCH] Emit error if requested service is not found
5+
6+
It currently just crashes instead of replying with error. Check return
7+
value and emit error instead of passing NULL pointer to reply.
8+
9+
Fixes #375
10+
---
11+
avahi-daemon/dbus-protocol.c | 20 ++++++++++++++------
12+
1 file changed, 14 insertions(+), 6 deletions(-)
13+
14+
diff --git a/avahi-daemon/dbus-protocol.c b/avahi-daemon/dbus-protocol.c
15+
index 70d7687b..406d0b44 100644
16+
--- a/avahi-daemon/dbus-protocol.c
17+
+++ b/avahi-daemon/dbus-protocol.c
18+
@@ -375,10 +375,14 @@ static DBusHandlerResult dbus_get_alternative_host_name(DBusConnection *c, DBusM
19+
}
20+
21+
t = avahi_alternative_host_name(n);
22+
- avahi_dbus_respond_string(c, m, t);
23+
- avahi_free(t);
24+
+ if (t) {
25+
+ avahi_dbus_respond_string(c, m, t);
26+
+ avahi_free(t);
27+
28+
- return DBUS_HANDLER_RESULT_HANDLED;
29+
+ return DBUS_HANDLER_RESULT_HANDLED;
30+
+ } else {
31+
+ return avahi_dbus_respond_error(c, m, AVAHI_ERR_NOT_FOUND, "Hostname not found");
32+
+ }
33+
}
34+
35+
static DBusHandlerResult dbus_get_alternative_service_name(DBusConnection *c, DBusMessage *m, DBusError *error) {
36+
@@ -389,10 +393,14 @@ static DBusHandlerResult dbus_get_alternative_service_name(DBusConnection *c, DB
37+
}
38+
39+
t = avahi_alternative_service_name(n);
40+
- avahi_dbus_respond_string(c, m, t);
41+
- avahi_free(t);
42+
+ if (t) {
43+
+ avahi_dbus_respond_string(c, m, t);
44+
+ avahi_free(t);
45+
46+
- return DBUS_HANDLER_RESULT_HANDLED;
47+
+ return DBUS_HANDLER_RESULT_HANDLED;
48+
+ } else {
49+
+ return avahi_dbus_respond_error(c, m, AVAHI_ERR_NOT_FOUND, "Service not found");
50+
+ }
51+
}
52+
53+
static DBusHandlerResult dbus_create_new_entry_group(DBusConnection *c, DBusMessage *m, DBusError *error) {

SPECS/avahi/avahi.spec

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Summary: Local network service discovery
44
Name: avahi
55
Version: 0.8
6-
Release: 2%{?dist}
6+
Release: 3%{?dist}
77
License: LGPLv2+
88
Vendor: Microsoft Corporation
99
Distribution: Azure Linux
@@ -12,6 +12,7 @@ Source0: https://github.com/lathiat/avahi/releases/download/v%{version}/%
1212
Patch0: %{name}-libevent-pc-fix.patch
1313
Patch1: CVE-2021-3468.patch
1414
Patch2: CVE-2021-3502.patch
15+
Patch3: CVE-2023-1981.patch
1516
BuildRequires: automake
1617
BuildRequires: dbus-devel >= 0.90
1718
BuildRequires: dbus-glib-devel >= 0.70
@@ -214,6 +215,9 @@ NOCONFIGURE=1 ./autogen.sh
214215
--disable-gtk \
215216
--disable-gtk3 \
216217
--disable-mono \
218+
%if 0%{?with_check}
219+
--enable-tests \
220+
%endif
217221
;
218222

219223
# workaround parallel build issues (aarch64 only so far, bug #1564553)
@@ -258,6 +262,7 @@ rm -fv %{buildroot}%{_datadir}/avahi/interfaces/avahi-discover.ui
258262

259263

260264
%check
265+
%make_build -k V=1 check || make check V=1
261266

262267
%pre
263268
getent group avahi >/dev/null || groupadd -f -g 70 -r avahi
@@ -415,6 +420,9 @@ exit 0
415420
%endif
416421

417422
%changelog
423+
* Tue Oct 29 2024 Daniel McIlvaney <damcilva@microsoft.com> - 0.8-3
424+
- Fix CVE-2023-1981 with an upstream patch, enable basic check section
425+
418426
* Wed Aug 14 2024 Chris Co <chrco@microsoft.com> - 0.8-2
419427
- Remove libssp from build environment to fix avahi-daemon hang
420428

0 commit comments

Comments
 (0)