mempool:fix bug read out of bounds when realloc
fix kasan report Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
parent
f24ab22b76
commit
045b9ffd54
@ -93,7 +93,7 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
|
|||||||
newmem = mm_malloc(heap, size);
|
newmem = mm_malloc(heap, size);
|
||||||
if (newmem != NULL)
|
if (newmem != NULL)
|
||||||
{
|
{
|
||||||
memcpy(newmem, oldmem, size);
|
memcpy(newmem, oldmem, MIN(size, mm_malloc_size(heap, oldmem)));
|
||||||
mm_free(heap, oldmem);
|
mm_free(heap, oldmem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user