Patrick Williams | 169d7bc | 2024-01-05 11:33:25 -0600 | [diff] [blame] | 1 | From b024ae5749f4aeba03478e6391687c3c9c8dee40 Mon Sep 17 00:00:00 2001 |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 2 | From: Michal Sekletar <msekleta@redhat.com> |
| 3 | Date: Thu, 19 Oct 2023 17:36:44 +0200 |
Patrick Williams | 169d7bc | 2024-01-05 11:33:25 -0600 | [diff] [blame] | 4 | Subject: [PATCH] core: make sure there is rdata to process before parsing it |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 5 | |
| 6 | Fixes #452 |
| 7 | |
Patrick Williams | 169d7bc | 2024-01-05 11:33:25 -0600 | [diff] [blame] | 8 | CVE-2023-38472 |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 9 | |
Patrick Williams | 169d7bc | 2024-01-05 11:33:25 -0600 | [diff] [blame] | 10 | Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/avahi/tree/debian/patches/CVE-2023-38472.patch?h=ubuntu/jammy-security |
| 11 | Upstream commit https://github.com/lathiat/avahi/commit/b024ae5749f4aeba03478e6391687c3c9c8dee40] |
| 12 | CVE: CVE-2023-38472 |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 13 | Signed-off-by: Meenali Gupta <meenali.gupta@windriver.com> |
Patrick Williams | 169d7bc | 2024-01-05 11:33:25 -0600 | [diff] [blame] | 14 | Signed-off-by: Vijay Anusuri <vanusuri@mvista.com> |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 15 | --- |
| 16 | avahi-client/client-test.c | 3 +++ |
| 17 | avahi-daemon/dbus-entry-group.c | 2 +- |
| 18 | 2 files changed, 4 insertions(+), 1 deletion(-) |
| 19 | |
Patrick Williams | 169d7bc | 2024-01-05 11:33:25 -0600 | [diff] [blame] | 20 | Index: avahi-0.8/avahi-client/client-test.c |
| 21 | =================================================================== |
| 22 | --- avahi-0.8.orig/avahi-client/client-test.c |
| 23 | +++ avahi-0.8/avahi-client/client-test.c |
| 24 | @@ -272,6 +272,9 @@ int main (AVAHI_GCC_UNUSED int argc, AVA |
| 25 | assert(error == AVAHI_ERR_INVALID_RECORD); |
| 26 | avahi_string_list_free(txt); |
| 27 | |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 28 | + error = avahi_entry_group_add_record (group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "TestX", 0x01, 0x10, 120, "", 0); |
| 29 | + assert(error != AVAHI_OK); |
| 30 | + |
| 31 | avahi_entry_group_commit (group); |
Patrick Williams | 169d7bc | 2024-01-05 11:33:25 -0600 | [diff] [blame] | 32 | |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 33 | domain = avahi_domain_browser_new (avahi, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_BROWSE, 0, avahi_domain_browser_callback, (char*) "omghai3u"); |
Patrick Williams | 169d7bc | 2024-01-05 11:33:25 -0600 | [diff] [blame] | 34 | Index: avahi-0.8/avahi-daemon/dbus-entry-group.c |
| 35 | =================================================================== |
| 36 | --- avahi-0.8.orig/avahi-daemon/dbus-entry-group.c |
| 37 | +++ avahi-0.8/avahi-daemon/dbus-entry-group.c |
| 38 | @@ -340,7 +340,7 @@ DBusHandlerResult avahi_dbus_msg_entry_g |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 39 | if (!(r = avahi_record_new_full (name, clazz, type, ttl))) |
| 40 | return avahi_dbus_respond_error(c, m, AVAHI_ERR_NO_MEMORY, NULL); |
Patrick Williams | 169d7bc | 2024-01-05 11:33:25 -0600 | [diff] [blame] | 41 | |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 42 | - if (avahi_rdata_parse (r, rdata, size) < 0) { |
| 43 | + if (!rdata || avahi_rdata_parse (r, rdata, size) < 0) { |
| 44 | avahi_record_unref (r); |
| 45 | return avahi_dbus_respond_error(c, m, AVAHI_ERR_INVALID_RDATA, NULL); |
| 46 | } |