newlib-nano-1.0 icon indicating copy to clipboard operation
newlib-nano-1.0 copied to clipboard

realloc copies too much data

Open alexpasq opened this issue 8 years ago • 0 comments

The nano_realloc() function in newlib/libc/stdlib/mallocr.c does a memcpy with size equal to the realloc parameter 'size', this can be a problem as we are copying from the original location more data than needed with the risk of triggering some faults in case the access to that memory is protected or not accessible. The implementation should use the old size for copying when the size increases.

alexpasq avatar Apr 13 '16 11:04 alexpasq