hfp_ag_demo, hfp_ag_client_test: avoid out-of-bounds stack read

This commit is contained in:
Matthias Ringwald 2020-01-07 22:13:31 +01:00
parent f959ac69f5
commit 9b9bd84a4f
2 changed files with 10 additions and 8 deletions

View File

@ -443,10 +443,11 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
if (hci_event_packet_get_type(event) != HCI_EVENT_HFP_META) return;
if (event[3]
&& hci_event_hfp_meta_get_subevent_code(event) != HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER
&& hci_event_hfp_meta_get_subevent_code(event) != HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG
&& hci_event_hfp_meta_get_subevent_code(event) != HFP_SUBEVENT_TRANSMIT_DTMF_CODES){
if ((event_size > 3)
&& (event[3] != 0)
&& (hci_event_hfp_meta_get_subevent_code(event) != HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER)
&& (hci_event_hfp_meta_get_subevent_code(event) != HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG)
&& (hci_event_hfp_meta_get_subevent_code(event) != HFP_SUBEVENT_TRANSMIT_DTMF_CODES)){
printf("ERROR, status: %u\n", event[3]);
return;
}

View File

@ -351,10 +351,11 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
if (event[0] != HCI_EVENT_HFP_META) return;
if (event[3]
&& event[2] != HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER
&& event[2] != HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG
&& event[2] != HFP_SUBEVENT_TRANSMIT_DTMF_CODES){
if ((event_size > 3)
&& (event[3] != 0)
&& (hci_event_hfp_meta_get_subevent_code(event) != HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER)
&& (hci_event_hfp_meta_get_subevent_code(event) != HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG)
&& (hci_event_hfp_meta_get_subevent_code(event) != HFP_SUBEVENT_TRANSMIT_DTMF_CODES)){
printf("ERROR, status: %u\n", event[3]);
return;
}