• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

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

system/bt


Commit MetaInfo

Revision64a5fc167566a482ddc88647dedf5fe059f94e51 (tree)
Time2019-01-18 19:52:46
AuthorMyles Watson <mylesgw@goog...>
CommiterVasyl Gello

Log Message

MCAP: Check response length in mca_ccb_hdl_rsp

Bug: 116319076
Test: Send a short MCAP response
Change-Id: I0452f7d2c0f4ecccc7a6501773e26b403b116179
(cherry picked from commit 0ab53ca2af26f70126d6d9d6600d090a720758fa)

Change Summary

Incremental Difference

--- a/stack/mcap/mca_cact.c
+++ b/stack/mcap/mca_cact.c
@@ -475,13 +475,27 @@ void mca_ccb_hdl_rsp(tMCA_CCB *p_ccb, tMCA_CCB_EVT *p_data)
475475 tMCA_RESULT result = MCA_BAD_HANDLE;
476476 tMCA_TC_TBL *p_tbl;
477477
478- if (p_ccb->p_tx_req)
478+ if (p_pkt->len < sizeof(evt_data.hdr.op_code) +
479+ sizeof(evt_data.rsp.rsp_code) +
480+ sizeof(evt_data.hdr.mdl_id))
481+ {
482+ android_errorWriteLog(0x534e4554, "116319076");
483+ MCA_TRACE_ERROR("%s: Response packet is too short", __func__);
484+ }
485+ else if (p_ccb->p_tx_req)
479486 {
480487 /* verify that the received response matches the sent request */
481488 p = (UINT8 *)(p_pkt + 1) + p_pkt->offset;
482489 evt_data.hdr.op_code = *p++;
483- if ((evt_data.hdr.op_code == 0) ||
484- ((p_ccb->p_tx_req->op_code + 1) == evt_data.hdr.op_code))
490+ if ((evt_data.hdr.op_code == MCA_OP_MDL_CREATE_RSP) &&
491+ (p_pkt->len <
492+ sizeof(evt_data.hdr.op_code) + sizeof(evt_data.rsp.rsp_code) +
493+ sizeof(evt_data.hdr.mdl_id) + sizeof(evt_data.create_cfm.cfg)))
494+ {
495+ android_errorWriteLog(0x534e4554, "116319076");
496+ MCA_TRACE_ERROR("%s: MDL Create Response packet is too short", __func__);
497+ } else if ((evt_data.hdr.op_code == 0) ||
498+ ((p_ccb->p_tx_req->op_code + 1) == evt_data.hdr.op_code))
485499 {
486500 evt_data.rsp.rsp_code = *p++;
487501 mca_stop_timer(p_ccb);