Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flatpak-proxy: Fix D-Bus disconnection with overly long object paths #50

Merged
merged 1 commit into from
Aug 7, 2023

Conversation

hadess
Copy link
Contributor

@hadess hadess commented Jul 20, 2023

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.

@hadess
Copy link
Contributor Author

hadess commented Jul 20, 2023

CC @phako

Copy link

@jadahl jadahl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like an oversight introduced when this function was added back in 2015 (004b7b2ca0e95d34a302c3b5c75ffd86ed64dd6b in flatpak). I'm no D-Bus internals expert, but i can't see why this change wouldn't be correct.

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
@hadess hadess force-pushed the wip/hadess/fix-bus-disconnection branch from 6f39775 to dea3530 Compare July 20, 2023 13:29
@hadess
Copy link
Contributor Author

hadess commented Jul 20, 2023

Looks like an oversight introduced when this function was added back in 2015 (004b7b2ca0e95d34a302c3b5c75ffd86ed64dd6b in flatpak). I'm no D-Bus internals expert, but i can't see why this change wouldn't be correct.

I've added a reference to that commit, thanks!

@matthiasclasen
Copy link
Contributor

Nice catch. The fix looks correct to me as well

@alexlarsson alexlarsson merged commit eb66edb into main Aug 7, 2023
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants