* grub-core/kern/mm.c (grub_realloc): Don't copy more data than we have.

This commit is contained in:
Vladimir Serbinenko 2013-11-01 14:39:33 +01:00
parent a602dc5425
commit b61599aca4
2 changed files with 6 additions and 1 deletions

View file

@ -1,3 +1,7 @@
2013-10-30 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/mm.c (grub_realloc): Don't copy more data than we have.
2013-10-30 Vladimir Serbinenko <phcoder@gmail.com> 2013-10-30 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/io/gzio.c (huft_build): Use zalloc for safety. * grub-core/io/gzio.c (huft_build): Use zalloc for safety.

View file

@ -483,7 +483,8 @@ grub_realloc (void *ptr, grub_size_t size)
if (! q) if (! q)
return q; return q;
grub_memcpy (q, ptr, size); /* We've already checked that p->size < n. */
grub_memcpy (q, ptr, p->size << GRUB_MM_ALIGN_LOG2);
grub_free (ptr); grub_free (ptr);
return q; return q;
} }