Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3108a62a authored by Android Build Merger (Role)'s avatar Android Build Merger (Role)
Browse files

[automerger] DO NOT MERGE Fix unexpected behavior in bta_dm_sdp_result am:...

[automerger] DO NOT MERGE Fix unexpected behavior in bta_dm_sdp_result am: c361d98b am: c074592e am: 6479e365

Change-Id: I9d0d9847904b361d457bba6b0f7dba6db9e6e10a
parents 95326a3b 6479e365
Loading
Loading
Loading
Loading
+16 −5
Original line number Original line Diff line number Diff line
@@ -37,6 +37,7 @@
#include "l2c_api.h"
#include "l2c_api.h"
#include "utl.h"
#include "utl.h"
#include "gap_api.h"    /* For GAP_BleReadPeerPrefConnParams */
#include "gap_api.h"    /* For GAP_BleReadPeerPrefConnParams */
#include <cutils/log.h>
#include <string.h>
#include <string.h>


#define LOG_TAG "bt_bta_dm"
#define LOG_TAG "bt_bta_dm"
@@ -46,6 +47,8 @@
#include "gap_api.h"
#include "gap_api.h"
#endif
#endif


#define BTA_MAX_SERVICES 32

static void bta_dm_inq_results_cb (tBTM_INQ_RESULTS *p_inq, UINT8 *p_eir);
static void bta_dm_inq_results_cb (tBTM_INQ_RESULTS *p_inq, UINT8 *p_eir);
static void bta_dm_inq_cmpl_cb (void * p_result);
static void bta_dm_inq_cmpl_cb (void * p_result);
static void bta_dm_service_search_remname_cback (BD_ADDR bd_addr, DEV_CLASS dc, BD_NAME bd_name);
static void bta_dm_service_search_remname_cback (BD_ADDR bd_addr, DEV_CLASS dc, BD_NAME bd_name);
@@ -1575,7 +1578,7 @@ void bta_dm_sdp_result (tBTA_DM_MSG *p_data)
#endif
#endif


    UINT32 num_uuids = 0;
    UINT32 num_uuids = 0;
    UINT8  uuid_list[32][MAX_UUID_SIZE]; // assuming a max of 32 services
    UINT8  uuid_list[BTA_MAX_SERVICES][MAX_UUID_SIZE]; // assuming a max of 32 services


    if((p_data->sdp_event.sdp_result == SDP_SUCCESS)
    if((p_data->sdp_event.sdp_result == SDP_SUCCESS)
        || (p_data->sdp_event.sdp_result == SDP_NO_RECS_MATCH)
        || (p_data->sdp_event.sdp_result == SDP_NO_RECS_MATCH)
@@ -1654,8 +1657,12 @@ void bta_dm_sdp_result (tBTA_DM_MSG *p_data)
                            (tBTA_SERVICE_MASK)(BTA_SERVICE_ID_TO_SERVICE_MASK(bta_dm_search_cb.service_index-1));
                            (tBTA_SERVICE_MASK)(BTA_SERVICE_ID_TO_SERVICE_MASK(bta_dm_search_cb.service_index-1));
                        tmp_svc = bta_service_id_to_uuid_lkup_tbl[bta_dm_search_cb.service_index-1];
                        tmp_svc = bta_service_id_to_uuid_lkup_tbl[bta_dm_search_cb.service_index-1];
                        /* Add to the list of UUIDs */
                        /* Add to the list of UUIDs */
                        if (num_uuids < BTA_MAX_SERVICES) {
                            sdpu_uuid16_to_uuid128(tmp_svc, uuid_list[num_uuids]);
                            sdpu_uuid16_to_uuid128(tmp_svc, uuid_list[num_uuids]);
                            num_uuids++;
                            num_uuids++;
                        } else {
                            android_errorWriteLog(0x534e4554, "74016921");
                        }
                    }
                    }
                }
                }
            }
            }
@@ -1697,8 +1704,12 @@ void bta_dm_sdp_result (tBTA_DM_MSG *p_data)
                {
                {
                    if (SDP_FindServiceUUIDInRec_128bit(p_sdp_rec, &temp_uuid))
                    if (SDP_FindServiceUUIDInRec_128bit(p_sdp_rec, &temp_uuid))
                    {
                    {
                        if (num_uuids < BTA_MAX_SERVICES) {
                            memcpy(uuid_list[num_uuids], temp_uuid.uu.uuid128, MAX_UUID_SIZE);
                            memcpy(uuid_list[num_uuids], temp_uuid.uu.uuid128, MAX_UUID_SIZE);
                            num_uuids++;
                            num_uuids++;
                        } else {
                            android_errorWriteLog(0x534e4554, "74016921");
                        }
                    }
                    }
                }
                }
            } while (p_sdp_rec);
            } while (p_sdp_rec);