[pulseaudio-discuss] [PATCH] bluetooth: Fix crash in pa_bluetooth_discovery_get_device_by_address()

João Paulo Rechi Vita jprvita at gmail.com
Wed Nov 20 05:51:10 PST 2013


On Wed, Nov 20, 2013 at 10:48 AM,  <jprvita at gmail.com> wrote:
> From: João Paulo Rechi Vita <jprvita at gmail.com>
>
> We need to check if d->adapter is valid before dereferencing it, and
> also make both address strings are valid before calling pa_streq().

Hum, I just realized a problem in the commit message. It should be
"make sure both address strings are valid", I'll send an updated
version right now, sorry for the noise.

> ---
>  src/modules/bluetooth/bluez5-util.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c
> index c8ff219..53330ab 100644
> --- a/src/modules/bluetooth/bluez5-util.c
> +++ b/src/modules/bluetooth/bluez5-util.c
> @@ -395,7 +395,9 @@ 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))
> +        if (d->address && pa_streq(d->address, remote) &&
> +            d->adapter && d->adapter->address && pa_streq(d->adapter->address, local))
> +
>              return d->device_info_valid == 1 ? d : NULL;
>
>      return NULL;
> --
> 1.8.3.1
>



-- 
João Paulo Rechi Vita
http://about.me/jprvita


More information about the pulseaudio-discuss mailing list