mirror of
https://github.com/monero-project/monero.git
synced 2024-12-27 04:39:27 -05:00
device_ledger: add paranoid buffer overflow check
Coverity 200183
This commit is contained in:
parent
cdfa2e58df
commit
7c894fc7fd
@ -320,7 +320,9 @@ namespace hw {
|
||||
bool device_ledger::reset() {
|
||||
reset_buffer();
|
||||
int offset = set_command_header_noopt(INS_RESET);
|
||||
memmove(this->buffer_send+offset, MONERO_VERSION, strlen(MONERO_VERSION));
|
||||
const size_t verlen = strlen(MONERO_VERSION);
|
||||
ASSERT_X(offset + verlen <= BUFFER_SEND_SIZE, "MONERO_VERSION is too long")
|
||||
memmove(this->buffer_send+offset, MONERO_VERSION, verlen);
|
||||
offset += strlen(MONERO_VERSION);
|
||||
this->buffer_send[4] = offset-5;
|
||||
this->length_send = offset;
|
||||
|
Loading…
Reference in New Issue
Block a user