xiaoxiang781216 commented on a change in pull request #4765:
URL: https://github.com/apache/incubator-nuttx/pull/4765#discussion_r740186030
##########
File path: mm/mm_heap/mm_realloc.c
##########
@@ -355,7 +355,7 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void
*oldmem,
newmem = (FAR void *)mm_malloc(heap, size);
if (newmem)
{
- memcpy(newmem, oldmem, oldsize);
+ memcpy(newmem, oldmem, oldsize - SIZEOF_MM_ALLOCNODE);
Review comment:
No, the problem isn't fee, but memcpy. oldsize include the house keeping
data(SIZEOF_MM_ALLOCNODE) before oldmem, memcpy with oldsize will overwrite
SIZEOF_MM_ALLOCNODE bytes of the next region.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]