system/bt
Revisão | e88c30b7dc0a3b3dbfe6c9e5620927fa2531700d (tree) |
---|---|
Hora | 2018-12-05 01:21:12 |
Autor | Ugo Yu <ugoyu@goog...> |
Commiter | Vasyl Gello |
DO NOT MERGE - Check SDU lower bound before allocate p_data
Bug: 112321180
Test: SL4A BleCocTest:test_coc_insecured_connection_write_ascii
Change-Id: Id0c9aa2097f0b6bdc2bb9fa9086daa9452188e1d
(cherry picked from commit 6fc96f847be808a4f38eae45b5e9bbc3f18b9a2d)
@@ -880,6 +880,13 @@ void l2c_lcc_proc_pdu(tL2C_CCB *p_ccb, BT_HDR *p_buf) | ||
880 | 880 | return; |
881 | 881 | } |
882 | 882 | |
883 | + if (sdu_length < p_buf->len) { | |
884 | + L2CAP_TRACE_ERROR("%s: Invalid sdu_length: %d", __func__, sdu_length); | |
885 | + android_errorWriteWithInfoLog(0x534e4554, "112321180", -1, NULL, 0); | |
886 | + /* Discard the buffer */ | |
887 | + osi_free(p_buf); | |
888 | + return; | |
889 | + } | |
883 | 890 | |
884 | 891 | if ((p_data = (BT_HDR *) osi_malloc(L2CAP_MAX_BUF_SIZE)) == NULL) |
885 | 892 | { |