Bug 34726 - Should send back an error if a message is corrupt (e.g. non-UTF-8 strings)
Summary: Should send back an error if a message is corrupt (e.g. non-UTF-8 strings)
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: 1.5
Hardware: All All
: medium enhancement
Assignee: D-Bus Maintainers
QA Contact: D-Bus Maintainers
Depends on:
Reported: 2011-02-25 08:43 UTC by Simon McVittie
Modified: 2018-10-12 21:08 UTC (History)
5 users (show)

See Also:
i915 platform:
i915 features:


Description Simon McVittie 2011-02-25 08:43:06 UTC
+++ This bug was initially created as a clone of Bug #16338 +++

On the original bug, Havoc wrote:
> Unfortunately, it's quite challenging to modify dbus-daemon to try sending back
> an error reply before it closes the socket; there may be another open bug about
> that, or at least a thread in list archives, and I think a patch makes sense,
> but, it isn't an easy patch to write iirc. (I don't remember the details.)
> The daemon would need to write out an error reply to the not-well-formed
> message, flush the socket as possible without blocking, then close the socket,
> all synchronously. 99% of the time the client would get the error, for
> debugging purposes, though it would not be guaranteed.
> That would be a good patch, in the meantime there's a simple fix that would
> have saved you: add a _dbus_return_if_fail(validate_utf8(arg)) to whatever
> public API function allowed you to marshal an invalid UTF-8 string.

and later, also:
> http://lists.freedesktop.org/archives/dbus/2007-November/008975.html

I'm going to hijack Bug #16338 for "validate the UTF-8 before sending", which fixes the 99% case.

It's still a bug that we don't send back an error, hence this clone, but adding those checks will mean we can drop the severity.
Comment 1 GitLab Migration User 2018-10-12 21:08:34 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/dbus/dbus/issues/41.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.