mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-01-11 04:47:54 -05:00
make sure limit match up with the multiple of 4 bytes alignment
This commit is contained in:
@@ -129,7 +129,7 @@ void BigBuf_Clear_keep_EM(void) {
|
||||
// allocate a chunk of memory from BigBuf. We allocate high memory first. The unallocated memory
|
||||
// at the beginning of BigBuf is always for traces/samples
|
||||
uint8_t *BigBuf_malloc(uint16_t chunksize) {
|
||||
if (s_bigbuf_hi < chunksize)
|
||||
if (s_bigbuf_hi < (chunksize + 3))
|
||||
return NULL; // no memory left
|
||||
|
||||
chunksize = (chunksize + 3) & 0xfffc; // round to next multiple of 4
|
||||
@@ -142,7 +142,7 @@ uint8_t *BigBuf_malloc(uint16_t chunksize) {
|
||||
uint8_t *BigBuf_calloc(uint16_t chunksize) {
|
||||
uint8_t *mem = BigBuf_malloc(chunksize);
|
||||
if (mem != NULL) {
|
||||
memset(mem, 0x00, chunksize);
|
||||
memset(mem, 0x00, ((chunksize + 3) & 0xfffc)); // round to next multiple of 4
|
||||
}
|
||||
return mem;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user