mirror of
https://github.com/wownero/wownero.git
synced 2026-10-17 15:41:44 +02:00
device_trezor: validate bridge response size before parsing
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user