mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 18:48:13 -07:00
coverity fix 226278 and offset computation as side effect
This commit is contained in:
parent
250418f64b
commit
155d30ce49
1 changed files with 3 additions and 3 deletions
|
@ -1642,7 +1642,7 @@ static void PacketReceived(PacketCommandNG *packet) {
|
|||
struct p {
|
||||
uint8_t flag;
|
||||
uint16_t offset;
|
||||
uint8_t *data;
|
||||
uint8_t data[PM3_CMD_DATA_SIZE - sizeof(uint8_t) - sizeof(uint16_t)];
|
||||
} PACKED;
|
||||
struct p *payload = (struct p *)packet->data.asBytes;
|
||||
|
||||
|
@ -1654,11 +1654,11 @@ static void PacketReceived(PacketCommandNG *packet) {
|
|||
}
|
||||
|
||||
// 40 000 - (512-3) 509 = 39491
|
||||
uint16_t offset = MIN(BIGBUF_SIZE - PM3_CMD_DATA_SIZE - 3, payload->offset);
|
||||
uint16_t offset = MIN(BIGBUF_SIZE - sizeof(payload->data), payload->offset);
|
||||
|
||||
// need to copy len bytes of data, not PM3_CMD_DATA_SIZE - 3 - offset
|
||||
// ensure len bytes copied wont go past end of bigbuf
|
||||
uint16_t len = MIN(BIGBUF_SIZE - offset, PM3_CMD_DATA_SIZE - 3);
|
||||
uint16_t len = MIN(BIGBUF_SIZE - offset, sizeof(payload->data));
|
||||
|
||||
uint8_t *mem = BigBuf_get_addr();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue