[pulseaudio-discuss] [PATCH 1/2] bluetooth: Fix potential NULL pointer dereference

Tanu Kaskinen tanuk at iki.fi
Wed Aug 17 12:52:28 UTC 2016


On Wed, 2016-08-17 at 14:43 +0200, Peter Meerwald-Stadler wrote:
> I can't find an easy argument why the NULL dereference can't happen (as I 
> am not intimate with the semantics of the dbus functions involved)

Sorry, I should have provided an explanation already in my previous
mail.

> why is d always != NULL when 
> dbus_message_is_method_call(p->message, "org.bluez.Device",
> "GetProperties") != 0?

Because of this part:

    if (dbus_message_has_interface(p->message, "org.bluez.Manager") ||
        dbus_message_has_interface(p->message, "org.bluez.Adapter"))
        d = NULL;
    else if (!(d = pa_hashmap_get(y->devices, dbus_message_get_path(p->message)))) {
        pa_log_warn("Received GetProperties() reply from unknown device: %s (device removed?)", dbus_message_get_path(p->message));
        goto finish2;
    }

d can be NULL only if p->message interface is org.bluez.Manager or
org.bluez.Adapter. If

    dbus_message_is_method_call(p->message, "org.bluez.Device", "GetProperties")

returns true, we know that the interface is org.bluez.Device.

-- 
Tanu


More information about the pulseaudio-discuss mailing list