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() {
|
bool device_ledger::reset() {
|
||||||
reset_buffer();
|
reset_buffer();
|
||||||
int offset = set_command_header_noopt(INS_RESET);
|
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);
|
offset += strlen(MONERO_VERSION);
|
||||||
this->buffer_send[4] = offset-5;
|
this->buffer_send[4] = offset-5;
|
||||||
this->length_send = offset;
|
this->length_send = offset;
|
||||||
|
|
Loading…
Reference in New Issue