Fix CVE-2023-38473
Resolves: RHEL-5729
This commit is contained in:
parent
5d0083e9a1
commit
7e8279ad9e
107
0001-common-derive-alternative-host-name-from-its-unescap.patch
Normal file
107
0001-common-derive-alternative-host-name-from-its-unescap.patch
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
From b448c9f771bada14ae8de175695a9729f8646797 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michal Sekletar <msekleta@redhat.com>
|
||||||
|
Date: Wed, 11 Oct 2023 17:45:44 +0200
|
||||||
|
Subject: [PATCH] common: derive alternative host name from its unescaped
|
||||||
|
version
|
||||||
|
|
||||||
|
Normalization of input makes sure we don't have to deal with special
|
||||||
|
cases like unescaped dot at the end of label.
|
||||||
|
|
||||||
|
Fixes #451 #487
|
||||||
|
CVE-2023-38473
|
||||||
|
---
|
||||||
|
avahi-common/alternative-test.c | 3 +++
|
||||||
|
avahi-common/alternative.c | 27 +++++++++++++++++++--------
|
||||||
|
2 files changed, 22 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/avahi-common/alternative-test.c b/avahi-common/alternative-test.c
|
||||||
|
index 9255435..681fc15 100644
|
||||||
|
--- a/avahi-common/alternative-test.c
|
||||||
|
+++ b/avahi-common/alternative-test.c
|
||||||
|
@@ -31,6 +31,9 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
|
||||||
|
const char* const test_strings[] = {
|
||||||
|
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||||
|
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXüüüüüüü",
|
||||||
|
+ ").",
|
||||||
|
+ "\\.",
|
||||||
|
+ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\",
|
||||||
|
"gurke",
|
||||||
|
"-",
|
||||||
|
" #",
|
||||||
|
diff --git a/avahi-common/alternative.c b/avahi-common/alternative.c
|
||||||
|
index b3d39f0..a094e6d 100644
|
||||||
|
--- a/avahi-common/alternative.c
|
||||||
|
+++ b/avahi-common/alternative.c
|
||||||
|
@@ -49,15 +49,20 @@ static void drop_incomplete_utf8(char *c) {
|
||||||
|
}
|
||||||
|
|
||||||
|
char *avahi_alternative_host_name(const char *s) {
|
||||||
|
+ char label[AVAHI_LABEL_MAX], alternative[AVAHI_LABEL_MAX*4+1];
|
||||||
|
+ char *alt, *r, *ret;
|
||||||
|
const char *e;
|
||||||
|
- char *r;
|
||||||
|
+ size_t len;
|
||||||
|
|
||||||
|
assert(s);
|
||||||
|
|
||||||
|
if (!avahi_is_valid_host_name(s))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
- if ((e = strrchr(s, '-'))) {
|
||||||
|
+ if (!avahi_unescape_label(&s, label, sizeof(label)))
|
||||||
|
+ return NULL;
|
||||||
|
+
|
||||||
|
+ if ((e = strrchr(label, '-'))) {
|
||||||
|
const char *p;
|
||||||
|
|
||||||
|
e++;
|
||||||
|
@@ -74,19 +79,18 @@ char *avahi_alternative_host_name(const char *s) {
|
||||||
|
|
||||||
|
if (e) {
|
||||||
|
char *c, *m;
|
||||||
|
- size_t l;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
n = atoi(e)+1;
|
||||||
|
if (!(m = avahi_strdup_printf("%i", n)))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
- l = e-s-1;
|
||||||
|
+ len = e-label-1;
|
||||||
|
|
||||||
|
- if (l >= AVAHI_LABEL_MAX-1-strlen(m)-1)
|
||||||
|
- l = AVAHI_LABEL_MAX-1-strlen(m)-1;
|
||||||
|
+ if (len >= AVAHI_LABEL_MAX-1-strlen(m)-1)
|
||||||
|
+ len = AVAHI_LABEL_MAX-1-strlen(m)-1;
|
||||||
|
|
||||||
|
- if (!(c = avahi_strndup(s, l))) {
|
||||||
|
+ if (!(c = avahi_strndup(label, len))) {
|
||||||
|
avahi_free(m);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
@@ -100,7 +104,7 @@ char *avahi_alternative_host_name(const char *s) {
|
||||||
|
} else {
|
||||||
|
char *c;
|
||||||
|
|
||||||
|
- if (!(c = avahi_strndup(s, AVAHI_LABEL_MAX-1-2)))
|
||||||
|
+ if (!(c = avahi_strndup(label, AVAHI_LABEL_MAX-1-2)))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
drop_incomplete_utf8(c);
|
||||||
|
@@ -109,6 +113,13 @@ char *avahi_alternative_host_name(const char *s) {
|
||||||
|
avahi_free(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ alt = alternative;
|
||||||
|
+ len = sizeof(alternative);
|
||||||
|
+ ret = avahi_escape_label(r, strlen(r), &alt, &len);
|
||||||
|
+
|
||||||
|
+ avahi_free(r);
|
||||||
|
+ r = avahi_strdup(ret);
|
||||||
|
+
|
||||||
|
assert(avahi_is_valid_host_name(r));
|
||||||
|
|
||||||
|
return r;
|
||||||
|
--
|
||||||
|
2.41.0
|
||||||
|
|
@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
Name: avahi
|
Name: avahi
|
||||||
Version: 0.8
|
Version: 0.8
|
||||||
Release: 15%{?dist}
|
Release: 16%{?dist}
|
||||||
Summary: Local network service discovery
|
Summary: Local network service discovery
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
URL: http://avahi.org
|
URL: http://avahi.org
|
||||||
@ -135,6 +135,7 @@ Patch11: 0011-avahi_dns_packet_consume_uint32-fix-potential-undefi.patch
|
|||||||
Patch12: 0001-Avoid-infinite-loop-in-avahi-daemon-by-handling-HUP-.patch
|
Patch12: 0001-Avoid-infinite-loop-in-avahi-daemon-by-handling-HUP-.patch
|
||||||
Patch13: 0001-Fix-NULL-pointer-crashes-from-175.patch
|
Patch13: 0001-Fix-NULL-pointer-crashes-from-175.patch
|
||||||
Patch14: 0001-Emit-error-if-requested-service-is-not-found.patch
|
Patch14: 0001-Emit-error-if-requested-service-is-not-found.patch
|
||||||
|
Patch15: 0001-common-derive-alternative-host-name-from-its-unescap.patch
|
||||||
|
|
||||||
## downstream patches
|
## downstream patches
|
||||||
Patch100: avahi-0.6.30-mono-libdir.patch
|
Patch100: avahi-0.6.30-mono-libdir.patch
|
||||||
@ -830,6 +831,9 @@ exit 0
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Nov 01 2023 Michal Sekletar <msekleta@redhat.com> - 0.8-16
|
||||||
|
- Fix CVE-2023-38473 (RHEL-5729)
|
||||||
|
|
||||||
* Wed Aug 23 2023 Michal Sekletar <msekleta@redhat.com> - 0.8-15
|
* Wed Aug 23 2023 Michal Sekletar <msekleta@redhat.com> - 0.8-15
|
||||||
- Fix CVE-2023-1981 (#2186689)
|
- Fix CVE-2023-1981 (#2186689)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user