newlib-nano-1.0
newlib-nano-1.0 copied to clipboard
realloc copies too much data
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.