device_trezor: validate bridge response size before parsing

This commit is contained in:
selsta
2026-07-27 19:53:04 +02:00
parent 11806688f9
commit 7162000866
+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");
}