]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
io/gzio: Properly init a table
authorDaniel Axtens <dja@axtens.net>
Sun, 12 May 2024 14:32:09 +0000 (00:32 +1000)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 6 Jun 2024 14:55:15 +0000 (16:55 +0200)
ARRAY_SIZE() is the count of elements, but the element size is 4 bytes, so
this was only initing the first 1/4th of the table. Detected with valgrind.

This should only matter in error paths, and I've not been able to identify
any actual misbehaviour that results from reading in-bounds but uninited data.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/io/gzio.c

index b882b559a1c5e069de4d4ced285070c1685a67c7..cb7eb1fe32e59193b63abb2b3f6c5a8f63843e12 100644 (file)
@@ -524,7 +524,7 @@ huft_build (unsigned *b,    /* code lengths in bits (all assumed <= BMAX) */
     }
 
   /* Make a table of values in order of bit lengths */
-  grub_memset (v, N_MAX, ARRAY_SIZE (v));
+  grub_memset (v, N_MAX, sizeof (v));
   p = b;
   i = 0;
   do