system/bt
Revisão | 278dab1f8c0f498a0ddc65911527adc043bade2b (tree) |
---|---|
Hora | 2018-10-08 17:42:13 |
Autor | Ugo Yu <ugoyu@goog...> |
Commiter | Vasyl Gello |
Add packet length check in smp_proc_master_id
Bug: 111937027
Test: manual
Change-Id: I1144c9879e84fa79d68ad9d5fece4f58e2a3b075
(cherry picked from commit c8294662d07a98e9b8b1cab1ab681ec0805ce4e8)
@@ -1033,6 +1033,16 @@ void smp_proc_master_id(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) | ||
1033 | 1033 | tBTM_LE_PENC_KEYS le_key; |
1034 | 1034 | |
1035 | 1035 | SMP_TRACE_DEBUG("%s", __func__); |
1036 | + | |
1037 | + if (p_cb->rcvd_cmd_len < 11) | |
1038 | + { | |
1039 | + // 1(Code) + 2(EDIV) + 8(Rand) | |
1040 | + android_errorWriteLog(0x534e4554, "111937027"); | |
1041 | + SMP_TRACE_ERROR("%s: Invalid command length: %d, should be at least 11", | |
1042 | + __func__, p_cb->rcvd_cmd_len); | |
1043 | + return; | |
1044 | + } | |
1045 | + | |
1036 | 1046 | smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_ENC, TRUE); |
1037 | 1047 | |
1038 | 1048 | STREAM_TO_UINT16(le_key.ediv, p); |