OSDN Git Service

sdptool: Fix recursive search
authorDavid Herrmann <dh.herrmann@gmail.com>
Mon, 18 Mar 2013 17:41:02 +0000 (18:41 +0100)
committerJohan Hedberg <johan.hedberg@intel.com>
Mon, 25 Mar 2013 10:44:21 +0000 (12:44 +0200)
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

index 458d005..0a949f2 100644 (file)
@@ -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);