• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/bt


コミットメタ情報

リビジョン828e5e16d8f93b2e2ca2df7ba4b57bcda8388696 (tree)
日時2019-02-21 13:37:26
作者Jakub Pawlowski <jpawlowski@goog...>
コミッターKevin Haggerty

ログメッセージ

Fix potential usage of freed memory in btif_hl_proc_sdp_query_cfm

Bug: 116222069
Test: compilation
Change-Id: Iebe2c500dfc2806ca321fdcd170e20c680619d4d
(cherry picked from commit 889efd5b9165ed7641fcd75eabbbef56be2ef5df)

変更サマリ

差分

--- a/bta/hl/bta_hl_main.c
+++ b/bta/hl/bta_hl_main.c
@@ -1564,15 +1564,14 @@ static void bta_hl_sdp_query_results(tBTA_HL_CB *p_cb, tBTA_HL_DATA *p_data)
15641564 tBTA_HL_MCL_CB *p_mcb = BTA_HL_GET_MCL_CB_PTR( app_idx, mcl_idx);
15651565 tBTA_HL_SDP *p_sdp=NULL;
15661566 UINT16 event;
1567- BOOLEAN release_sdp_buf=FALSE;
15681567 UNUSED(p_cb);
15691568
15701569 event = p_data->hdr.event;
15711570
15721571 if (event == BTA_HL_SDP_QUERY_OK_EVT) {
1572+ // this is freed in btif_hl_proc_sdp_query_cfm
15731573 p_sdp = (tBTA_HL_SDP *)osi_malloc(sizeof(tBTA_HL_SDP));
15741574 memcpy(p_sdp, &p_mcb->sdp, sizeof(tBTA_HL_SDP));
1575- release_sdp_buf = TRUE;
15761575 } else {
15771576 status = BTA_HL_STATUS_SDP_FAIL;
15781577 }
@@ -1589,9 +1588,6 @@ static void bta_hl_sdp_query_results(tBTA_HL_CB *p_cb, tBTA_HL_DATA *p_data)
15891588 p_mcb->bd_addr,p_sdp,status);
15901589 p_acb->p_cback(BTA_HL_SDP_QUERY_CFM_EVT,(tBTA_HL *) &evt_data );
15911590
1592- if (release_sdp_buf)
1593- osi_free_and_reset((void **)&p_sdp);
1594-
15951591 if (p_data->cch_sdp.release_mcl_cb) {
15961592 memset(p_mcb, 0, sizeof(tBTA_HL_MCL_CB));
15971593 } else {
--- a/btif/src/btif_hl.c
+++ b/btif/src/btif_hl.c
@@ -2333,6 +2333,10 @@ static BOOLEAN btif_hl_proc_sdp_query_cfm(tBTA_HL *p_data){
23332333 }
23342334 }
23352335 }
2336+
2337+ // this was allocated in bta_hl_sdp_query_results
2338+ osi_free_and_reset((void**)&p_data->sdp_query_cfm.p_sdp);
2339+
23362340 return status;
23372341 }
23382342