Fix malloc, calloc and realloc by powware · Pull Request #3 · pbatard/ntfs-3g (original) (raw)
calloc and realloc only track the size that has been requested by the user, when realloc then forwards the size to ReallocatePool the sizeof(size_t) is missing and the memcopy of ReallocatePool misses these bytes.
Addtionally calloc only tracks the size parameter where it should instead track the product of nmemb and size.
I rewrote malloc, calloc and realloc to track the true size in memory for easier handling.