From b705e38a795cba0b6ef8c611ed78fa884185025d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?= Date: Wed, 20 Nov 2013 18:21:36 -0300 Subject: [PATCH] bluetooth: Fix crash in pa_bluetooth_discovery_get_device_by_address() We need to check if the device information is valid first, so we don't pass invalid strings to pa_streq(). --- src/modules/bluetooth/bluez5-util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c index d2893c0a..c7fb6ae5 100644 --- a/src/modules/bluetooth/bluez5-util.c +++ b/src/modules/bluetooth/bluez5-util.c @@ -395,8 +395,8 @@ pa_bluetooth_device* pa_bluetooth_discovery_get_device_by_address(pa_bluetooth_d pa_assert(local); while ((d = pa_hashmap_iterate(y->devices, &state, NULL))) - if (pa_streq(d->address, remote) && pa_streq(d->adapter->address, local)) - return d->device_info_valid == 1 ? d : NULL; + if (d->device_info_valid == 1 && pa_streq(d->address, remote) && pa_streq(d->adapter->address, local)) + return d; return NULL; } -- 2.39.2