mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
device_ledger: fix potential buffer overflow from bad size calc
This commit is contained in:
parent
0429cabefd
commit
076b7e1076
1 changed files with 4 additions and 2 deletions
|
@ -194,7 +194,8 @@ namespace hw {
|
||||||
this->buffer_send[3],
|
this->buffer_send[3],
|
||||||
this->buffer_send[4]
|
this->buffer_send[4]
|
||||||
);
|
);
|
||||||
buffer_to_str(strbuffer+strlen(strbuffer), sizeof(strbuffer), (char*)(this->buffer_send+5), this->length_send-5);
|
const size_t len = strlen(strbuffer);
|
||||||
|
buffer_to_str(strbuffer+len, sizeof(strbuffer)-len, (char*)(this->buffer_send+5), this->length_send-5);
|
||||||
MDEBUG( "CMD :" << strbuffer);
|
MDEBUG( "CMD :" << strbuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -206,7 +207,8 @@ namespace hw {
|
||||||
this->buffer_recv[this->length_recv-2],
|
this->buffer_recv[this->length_recv-2],
|
||||||
this->buffer_recv[this->length_recv-1]
|
this->buffer_recv[this->length_recv-1]
|
||||||
);
|
);
|
||||||
buffer_to_str(strbuffer+strlen(strbuffer), sizeof(strbuffer), (char*)(this->buffer_recv), this->length_recv-2);
|
const size_t len = strlen(strbuffer);
|
||||||
|
buffer_to_str(strbuffer+len, sizeof(strbuffer)-len, (char*)(this->buffer_recv), this->length_recv-2);
|
||||||
MDEBUG( "RESP :" << strbuffer);
|
MDEBUG( "RESP :" << strbuffer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue