public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] shared/gatt-db: fix crash on bad attribute index in get_char_data
@ 2025-04-20 21:36 Pauli Virtanen
  2025-04-22  9:11 ` patchwork-bot+bluetooth
  0 siblings, 1 reply; 2+ messages in thread
From: Pauli Virtanen @ 2025-04-20 21:36 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

Fix AddressSanitizer: heap-buffer-overflow when index == 0.
---
 src/shared/gatt-db.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c
index b44140523..8951079be 100644
--- a/src/shared/gatt-db.c
+++ b/src/shared/gatt-db.c
@@ -1980,8 +1980,8 @@ bool gatt_db_attribute_get_char_data(const struct gatt_db_attribute *attrib,
 
 		/* Check if Characteristic Value was passed instead */
 		index = gatt_db_attribute_get_index(attrib);
-		if (index < 0)
-			return NULL;
+		if (index <= 0)
+			return false;
 
 		attrib = attrib->service->attributes[index - 1];
 		if (bt_uuid_cmp(&characteristic_uuid, &attrib->uuid))
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH BlueZ] shared/gatt-db: fix crash on bad attribute index in get_char_data
  2025-04-20 21:36 [PATCH BlueZ] shared/gatt-db: fix crash on bad attribute index in get_char_data Pauli Virtanen
@ 2025-04-22  9:11 ` patchwork-bot+bluetooth
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+bluetooth @ 2025-04-22  9:11 UTC (permalink / raw)
  To: Pauli Virtanen; +Cc: linux-bluetooth

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Mon, 21 Apr 2025 00:36:32 +0300 you wrote:
> Fix AddressSanitizer: heap-buffer-overflow when index == 0.
> ---
>  src/shared/gatt-db.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Here is the summary with links:
  - [BlueZ] shared/gatt-db: fix crash on bad attribute index in get_char_data
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=73ae3fb93d27

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-22  9:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-20 21:36 [PATCH BlueZ] shared/gatt-db: fix crash on bad attribute index in get_char_data Pauli Virtanen
2025-04-22  9:11 ` patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox