Skip to contentSkip to conversation

sdptool: fix recursive search

PATCH Applied David Herrmann 2 participants 2 messages Mar 18, 2013 – Mar 25, 2013 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sdptool: fix recursive search

When doing recursive SDP searches, we must not overwrite our own values after we retrieved them from SDP. Otherwise, the UUID test will always we false.

---
 tools/sdptool.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/sdptool.c +3 -2
index 458d005..0a949f2 100644
@@ -3812,9 +3812,10 @@ static int do_search(bdaddr_t *bdaddr, struct search_context *context)
 			break;
 		}
 
+		/* Set the subcontext for browsing the sub tree */
+		memcpy(&sub_context, context, sizeof(struct search_context));
+
 		if (sdp_get_group_id(rec, &sub_context.group) != -1) {
-			/* Set the subcontext for browsing the sub tree */
-			memcpy(&sub_context, context, sizeof(struct search_context));
 			/* Browse the next level down if not done */
 			if (sub_context.group.value.uuid16 != context->group.value.uuid16)
 				do_search(bdaddr, &sub_context);
Signature · 1 line
1.8.2
#1 lore raw

Hi David,

Quoted 6 lines · David Herrmann

When doing recursive SDP searches, we must not overwrite our own values after we retrieved them from SDP. Otherwise, the UUID test will always we false.

---
 tools/sdptool.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Applied. Thanks.

Johan