mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-12-26 18:12:34 +08:00
make sure limit match up with the multiple of 4 bytes alignment
This commit is contained in:
parent
a2327cfe20
commit
17ab86c52c
1 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue