Commit 5e39671e authored by Bastien Nocera's avatar Bastien Nocera Committed by Ross Burton

Don't lose special D-Bus error sauce when copying

When copying errors for later use, make sure to copy D-Bus
errors special sauce (domain name of the error copied after the
string itself).

Fixes possible crashers in geoclue-master when returning a
cached provider error.


With debugging help from Colin Walters and Matthias Clasen.
parent b0808f23
......@@ -126,6 +126,19 @@ copy_error (GError **target, GError *source)
if (source) {
*target = g_error_copy (source);
/* If the error type is a D-Bus remote exception,
* don't lose the "magic" sauce after the message string.
* See the code in gerror_to_dbus_error_message() in dbus-glib */
if (source->domain == DBUS_GERROR &&
int len;
g_free ((*target)->message);
len = strlen (source->message);
len += strlen (source->message + len + 1);
len += 2;
(*target)->message = g_memdup (source->message, len);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment