1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-15 20:19:23 +00:00

More input sanity checks in EthereumSignTx

This commit is contained in:
Alex Beregszaszi 2016-05-25 15:39:11 +01:00
parent a617200c9c
commit 78b1370de9

View File

@ -202,11 +202,18 @@ void ethereum_signing_init(EthereumSignTx *msg, const HDNode *node)
/* FIXME: simplify this check */
if (msg->has_data_initial_chunk) {
if (msg->has_data_length && msg->data_initial_chunk.size != 1024) {
if (msg->has_data_length) {
if (msg->data_initial_chunk.size != 1024) {
fsm_sendFailure(FailureType_Failure_Other, "Data length provided, but initial chunk too small");
ethereum_signing_abort();
return;
}
if (msg->data_length == 0) {
fsm_sendFailure(FailureType_Failure_Other, "Invalid data length provided");
ethereum_signing_abort();
return;
}
}
} else if (msg->has_data_length) {
fsm_sendFailure(FailureType_Failure_Other, "Data length provided, but no initial chunk");
ethereum_signing_abort();