Merge pull request #10988

7162000 device_trezor: validate bridge response size before parsing (selsta)

ACKs: jpk68, tobtoht, SNeedlewoods
This commit is contained in:
tobtoht
2026-08-02 16:18:14 +00:00
+2 -2
View File
@@ -481,14 +481,14 @@ namespace trezor{
}
boost::optional<epee::wipeable_string> bin_data = m_response->parse_hexstr();
if (!bin_data){
if (!bin_data || bin_data->size() < PROTO_HEADER_SIZE){
throw exc::CommunicationException("Response is not well hexcoded");
}
uint16_t msg_tag;
uint32_t msg_len;
deserialize_message_header(bin_data->data(), msg_tag, msg_len);
if (bin_data->size() != msg_len + PROTO_HEADER_SIZE){
if (bin_data->size() - PROTO_HEADER_SIZE != msg_len){
throw exc::CommunicationException("Response is not well hexcoded");
}