diff options
-rw-r--r-- | btif/src/bluetooth.cc | 5 | ||||
-rw-r--r-- | stack/sdp/sdp_discovery.cc | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/btif/src/bluetooth.cc b/btif/src/bluetooth.cc index a72f787f5..6bf4152c8 100644 --- a/btif/src/bluetooth.cc +++ b/btif/src/bluetooth.cc @@ -359,11 +359,14 @@ static int get_connection_state(const RawAddress* bd_addr) { static int pin_reply(const RawAddress* bd_addr, uint8_t accept, uint8_t pin_len, bt_pin_code_t* pin_code) { + bt_pin_code_t tmp_pin_code; if (!interface_ready()) return BT_STATUS_NOT_READY; if (pin_code == nullptr || pin_len > PIN_CODE_LEN) return BT_STATUS_FAIL; + memcpy(&tmp_pin_code, pin_code, pin_len); + do_in_main_thread(FROM_HERE, base::BindOnce(btif_dm_pin_reply, *bd_addr, - accept, pin_len, *pin_code)); + accept, pin_len, tmp_pin_code)); return BT_STATUS_SUCCESS; } diff --git a/stack/sdp/sdp_discovery.cc b/stack/sdp/sdp_discovery.cc index e6075407e..fc53fc740 100644 --- a/stack/sdp/sdp_discovery.cc +++ b/stack/sdp/sdp_discovery.cc @@ -282,7 +282,7 @@ static void process_service_search_rsp(tCONN_CB* p_ccb, uint8_t* p_reply, orig = p_ccb->num_handles; p_ccb->num_handles += cur_handles; - if (p_ccb->num_handles == 0) { + if (p_ccb->num_handles == 0 || p_ccb->num_handles < orig) { SDP_TRACE_WARNING("SDP - Rcvd ServiceSearchRsp, no matches"); sdp_disconnect(p_ccb, SDP_NO_RECS_MATCH); return; |