mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
another fix
This commit is contained in:
parent
2044fd4130
commit
e0bd6b2019
1 changed files with 7 additions and 3 deletions
|
@ -65,11 +65,15 @@ static RetType write_to_buffer(void *cookie, const char *data, LenType len) {
|
||||||
if (newsize >= b->alloc) { // NB! one extra byte is needed to avoid buffer overflow at close_buffer
|
if (newsize >= b->alloc) { // NB! one extra byte is needed to avoid buffer overflow at close_buffer
|
||||||
// make room
|
// make room
|
||||||
size_t newalloc = newsize + newsize / 2 + 1; // give 50% more room
|
size_t newalloc = newsize + newsize / 2 + 1; // give 50% more room
|
||||||
ptr = realloc(ptr, newalloc);
|
|
||||||
if (ptr == NULL) {
|
char *tmp = realloc(ptr, newalloc);
|
||||||
|
if ( tmp == NULL ) {
|
||||||
free(ptr);
|
free(ptr);
|
||||||
return -1;
|
return -1;
|
||||||
)
|
} else {
|
||||||
|
ptr = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
b->alloc = newalloc;
|
b->alloc = newalloc;
|
||||||
*b->ptr = ptr;
|
*b->ptr = ptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue