mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
device_ledger: add paranoid buffer overflow check
Coverity 200183
This commit is contained in:
parent
cdfa2e58df
commit
7c894fc7fd
1 changed files with 3 additions and 1 deletions
|
@ -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 a new issue