mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-16 18:13:13 +08:00
CHG: added extra out-of-bounds check when downloading data from device.
This commit is contained in:
parent
98f0e9a284
commit
c7067d0057
1 changed files with 5 additions and 0 deletions
|
@ -236,6 +236,11 @@ void UsbCommandReceived(UsbCommand* _ch) {
|
|||
uint32_t len = MIN(c->arg[1], sample_buf_size);
|
||||
//uint32_t tracelen = c->arg[2];
|
||||
|
||||
// extended bounds check.
|
||||
if ( offset + len > sample_buf_size ) {
|
||||
PrintAndLogEx(FAILED, "ERROR: Out of bounds when downloading from device, offset %u | len %u | total len %u > sample_buf_size %u", offset, len, offset+len, sample_buf_size);
|
||||
break;
|
||||
}
|
||||
//printf("SAMPLE_BUF_SIZE %u | adjusted len %u | offset %u\n", sample_buf_size, len, offset);
|
||||
|
||||
memcpy( sample_buf + offset, c->d.asBytes, len);
|
||||
|
|
Loading…
Reference in a new issue