diff options
author | Matadeen Mishra <matade@codeaurora.org> | 2015-08-21 09:47:05 +0530 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2015-10-06 03:22:00 -0600 |
commit | fada44256f77be2e7cdf1b6089c15c4b08a76046 (patch) | |
tree | 3a19278722436dd7dfc10c723f1feacb1632754b /stack/mcap/mca_main.c | |
parent | c50610c030fc7b0bd547750a9851b772d836391a (diff) | |
download | android_system_bt-fada44256f77be2e7cdf1b6089c15c4b08a76046.tar.gz android_system_bt-fada44256f77be2e7cdf1b6089c15c4b08a76046.tar.bz2 android_system_bt-fada44256f77be2e7cdf1b6089c15c4b08a76046.zip |
BT: Fixed Static Analysis Issues
- This fix avoids NULL pointer dereferences,
Array Index Out of Bounds Exceptions
and Banned funciton in the bluedroid code
space of Bluetooth.
CRs-Fixed: 890309, 890321
Change-Id: I24ae794ee01b65b5ab15c73cd82677b0481910ad
Diffstat (limited to 'stack/mcap/mca_main.c')
-rw-r--r-- | stack/mcap/mca_main.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/stack/mcap/mca_main.c b/stack/mcap/mca_main.c index b99c71206..1bf16dd0d 100644 --- a/stack/mcap/mca_main.c +++ b/stack/mcap/mca_main.c @@ -265,7 +265,7 @@ void mca_set_cfg_by_tbl(tL2CAP_CFG_INFO *p_cfg, tMCA_TC_TBL *p_tbl) else { p_dcb = mca_dcb_by_hdl(p_tbl->cb_idx); - if (p_dcb) + if (p_dcb !=NULL) { p_opt = &p_dcb->p_chnl_cfg->fcr_opt; fcs = p_dcb->p_chnl_cfg->fcs; @@ -323,7 +323,10 @@ void mca_tc_close_ind(tMCA_TC_TBL *p_tbl, UINT16 reason) if (p_tbl->tcid == MCA_CTRL_TCID) { p_ccb = mca_ccb_by_hdl((tMCA_CL)p_tbl->cb_idx); - mca_ccb_event(p_ccb, MCA_CCB_LL_CLOSE_EVT, (tMCA_CCB_EVT *)&close); + if(p_ccb != NULL) + { + mca_ccb_event(p_ccb, MCA_CCB_LL_CLOSE_EVT, (tMCA_CCB_EVT *)&close); + } } /* notify dcb that channel close */ else @@ -372,8 +375,10 @@ void mca_tc_open_ind(tMCA_TC_TBL *p_tbl) if (p_tbl->tcid == MCA_CTRL_TCID) { p_ccb = mca_ccb_by_hdl((tMCA_CL)p_tbl->cb_idx); - - mca_ccb_event(p_ccb, MCA_CCB_LL_OPEN_EVT, (tMCA_CCB_EVT *)&open); + if(p_ccb !=NULL) + { + mca_ccb_event(p_ccb, MCA_CCB_LL_OPEN_EVT, (tMCA_CCB_EVT *)&open); + } } /* must be data channel, notify dcb that channel open */ else @@ -415,7 +420,10 @@ void mca_tc_cong_ind(tMCA_TC_TBL *p_tbl, BOOLEAN is_congested) if (p_tbl->tcid == MCA_CTRL_TCID) { p_ccb = mca_ccb_by_hdl((tMCA_CL)p_tbl->cb_idx); - mca_ccb_event(p_ccb, MCA_CCB_LL_CONG_EVT, (tMCA_CCB_EVT *) &is_congested); + if(p_ccb != NULL) + { + mca_ccb_event(p_ccb, MCA_CCB_LL_CONG_EVT, (tMCA_CCB_EVT *) &is_congested); + } } /* notify dcb that channel open */ else |