avrcp: only parse get element attributes for AVRCP_CTYPE_RESPONSE_IMPLEMENTED_STABLE or AVRCP_CTYPE_RESPONSE_CHANGED_STABLE

This commit is contained in:
Matthias Ringwald 2017-06-02 16:00:20 +02:00
parent 849f10d83f
commit 4bb88fd7fc

View File

@ -864,6 +864,7 @@ static void avrcp_handle_l2cap_data_packet_for_signaling_connection(avrcp_connec
uint8_t num_string_attributes = 0; uint8_t num_string_attributes = 0;
uint16_t total_event_payload_for_string_attributes = HCI_EVENT_PAYLOAD_SIZE-2; uint16_t total_event_payload_for_string_attributes = HCI_EVENT_PAYLOAD_SIZE-2;
uint16_t max_string_attribute_value_len = 0; uint16_t max_string_attribute_value_len = 0;
if (ctype == AVRCP_CTYPE_RESPONSE_IMPLEMENTED_STABLE || ctype == AVRCP_CTYPE_RESPONSE_CHANGED_STABLE){
for (i = 0; i < num_attributes; i++){ for (i = 0; i < num_attributes; i++){
avrcp_media_attribute_id_t attr_id = big_endian_read_32(packet, pos); avrcp_media_attribute_id_t attr_id = big_endian_read_32(packet, pos);
pos += 4; pos += 4;
@ -900,6 +901,8 @@ static void avrcp_handle_l2cap_data_packet_for_signaling_connection(avrcp_connec
} }
pos += attr_value_length; pos += attr_value_length;
} }
}
// subtract space for fixed fields // subtract space for fixed fields
total_event_payload_for_string_attributes -= 14 + 4; // 4 for '\0' total_event_payload_for_string_attributes -= 14 + 4; // 4 for '\0'