You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/11/01 12:02:35 UTC

[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #4765: mm: fix realloc overwrite memcpy when use a new block

Ouss4 commented on a change in pull request #4765:
URL: https://github.com/apache/incubator-nuttx/pull/4765#discussion_r740159758



##########
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:
       was the following `free` failing here?




-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org