From 05fbf4c6ae516266f69ecb0c17e20f685c94b625 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Wed, 19 Jul 2023 14:43:18 +0200 Subject: [PATCH] Fix D-Bus disconnection when an object path was overly long --- ...x-D-Bus-disconnection-with-overly-lo.patch | 37 +++++++++++++++++++ xdg-dbus-proxy.spec | 8 +++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 0001-flatpak-proxy-Fix-D-Bus-disconnection-with-overly-lo.patch diff --git a/0001-flatpak-proxy-Fix-D-Bus-disconnection-with-overly-lo.patch b/0001-flatpak-proxy-Fix-D-Bus-disconnection-with-overly-lo.patch new file mode 100644 index 0000000..b37c045 --- /dev/null +++ b/0001-flatpak-proxy-Fix-D-Bus-disconnection-with-overly-lo.patch @@ -0,0 +1,37 @@ +From dea3530414f8d118e64f8ae408eb19f479abc082 Mon Sep 17 00:00:00 2001 +From: Bastien Nocera +Date: Thu, 20 Jul 2023 14:48:41 +0200 +Subject: [PATCH] flatpak-proxy: Fix D-Bus disconnection with overly long + object paths + +According to the D-Bus specifications: +https://dbus.freedesktop.org/doc/dbus-specification.html#id-1.4.4 +For the STRING and OBJECT_PATH types, [the data length] is encoded in 4 +bytes (a UINT32). + +But the code was trying to parse the 32-bit integer as an 8-bit one, +meaning that, as was the case with object paths created by the dLeyna +project, a 259-byte long string would be parsed like a 3-byte long +one. + +Fixes: 004b7b2ca0e9 ("Parse dbus headers") in flatpak +--- + flatpak-proxy.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/flatpak-proxy.c b/flatpak-proxy.c +index 48781560c8bc..47e51df3df40 100644 +--- a/flatpak-proxy.c ++++ b/flatpak-proxy.c +@@ -1116,7 +1116,7 @@ get_signature (Buffer *buffer, guint32 *offset, guint32 end_offset) + static const char * + get_string (Buffer *buffer, Header *header, guint32 *offset, guint32 end_offset) + { +- guint8 len; ++ guint32 len; + char *str; + + *offset = align_by_4 (*offset); +-- +2.41.0 + diff --git a/xdg-dbus-proxy.spec b/xdg-dbus-proxy.spec index dc3834f..de9ff01 100644 --- a/xdg-dbus-proxy.spec +++ b/xdg-dbus-proxy.spec @@ -1,6 +1,6 @@ Name: xdg-dbus-proxy Version: 0.1.4 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Filtering proxy for D-Bus connections License: LGPLv2+ @@ -17,6 +17,9 @@ BuildRequires: /usr/bin/xsltproc Requires: dbus +# https://github.com/flatpak/xdg-dbus-proxy/pull/50 +Patch0: 0001-flatpak-proxy-Fix-D-Bus-disconnection-with-overly-lo.patch + %description xdg-dbus-proxy is a filtering proxy for D-Bus connections. It was originally part of the flatpak project, but it has been broken out as a standalone module @@ -38,6 +41,9 @@ to facilitate using it in other contexts. %{_mandir}/man1/xdg-dbus-proxy.1* %changelog +* Wed Jul 19 2023 Bastien Nocera - 0.1.4-2 +- Fix D-Bus disconnection when an object path was overly long + * Wed Jul 19 2023 Bastien Nocera - 0.1.4-1 - Update to 0.1.4