diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2012-08-22 16:38:49 -0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-08-23 15:14:22 +0300 |
commit | 1ea2ce1c0ab8504c5977c2f009c84c6eb931d9f0 (patch) | |
tree | 6872aeaf1ba5e7a3ede13233da5ffb350cc850ff /profiles/gatt | |
parent | 8ff63e27074622730b6c97c4c73d6c13b7fcf3c5 (diff) | |
download | bluez-1ea2ce1c0ab8504c5977c2f009c84c6eb931d9f0.tar.gz |
gatt: GAP and GATT services are mandatory
This patch fixes potential segmentation fault if the remote doesn't
support GAP and GATT services.
Diffstat (limited to 'profiles/gatt')
-rw-r--r-- | profiles/gatt/manager.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/profiles/gatt/manager.c b/profiles/gatt/manager.c index a1fa75608..0702d2645 100644 --- a/profiles/gatt/manager.c +++ b/profiles/gatt/manager.c @@ -30,6 +30,7 @@ #include "gattrib.h" #include "gatt.h" #include "gas.h" +#include "log.h" #include "manager.h" static gint primary_uuid_cmp(gconstpointer a, gconstpointer b) @@ -55,8 +56,12 @@ static int gatt_driver_probe(struct btd_device *device, GSList *uuids) if (l) gatt = l->data; - return gas_register(device, gap ? &gap->range : NULL, - gatt ? &gatt->range : NULL); + if (gap == NULL || gatt == NULL) { + error("GAP and GATT are mandatory"); + return -EINVAL; + } + + return gas_register(device, &gap->range, &gatt->range); } static void gatt_driver_remove(struct btd_device *device) |