* [PATCH] shared/gatt: Check if handles counter is not wrapped
@ 2014-05-06 14:27 Szymon Janc
2014-05-07 11:21 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Szymon Janc @ 2014-05-06 14:27 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
Make sure that handles are fitting in UINT16_MAX range before adding
service to database.
---
src/shared/gatt-db.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c
index 6a15a4c..ebfd586 100644
--- a/src/shared/gatt-db.c
+++ b/src/shared/gatt-db.c
@@ -162,7 +162,7 @@ uint16_t gatt_db_add_service(struct gatt_db *db, const bt_uuid_t *uuid,
uint8_t value[16];
uint16_t len;
- if (num_handles < 1)
+ if (num_handles < 1 || (num_handles + db->next_handle) > UINT16_MAX)
return 0;
service = new0(struct gatt_db_service, 1);
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] shared/gatt: Check if handles counter is not wrapped
2014-05-06 14:27 [PATCH] shared/gatt: Check if handles counter is not wrapped Szymon Janc
@ 2014-05-07 11:21 ` Johan Hedberg
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2014-05-07 11:21 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth
Hi Szymon,
On Tue, May 06, 2014, Szymon Janc wrote:
> Make sure that handles are fitting in UINT16_MAX range before adding
> service to database.
> ---
> src/shared/gatt-db.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied. Thanks.
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-05-07 11:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-06 14:27 [PATCH] shared/gatt: Check if handles counter is not wrapped Szymon Janc
2014-05-07 11:21 ` Johan Hedberg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.