]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/kern/mm.c (grub_realloc): Don't copy more data than we have.
authorVladimir Serbinenko <phcoder@gmail.com>
Fri, 1 Nov 2013 13:39:33 +0000 (14:39 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Fri, 1 Nov 2013 13:39:33 +0000 (14:39 +0100)
ChangeLog
grub-core/kern/mm.c

index 6e9abacf6d1c24d68353c23fc672451ebaf31786..7e0b0af5ebdc1115048789efd389744911999f5e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * grub-core/io/gzio.c (huft_build): Use zalloc for safety.
index 59e45c7ae5868a0f952ccdf52aca5a5208d2f51f..5e53b07f4fa88ea0c38c5a5017fc377ff6594e68 100644 (file)
@@ -483,7 +483,8 @@ grub_realloc (void *ptr, grub_size_t size)
   if (! 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);
   return q;
 }