grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] gzio: Properly init a table


From: Daniel Axtens
Subject: [PATCH 2/2] gzio: Properly init a table
Date: Mon, 13 May 2024 00:32:09 +1000

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.

---
 grub-core/io/gzio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grub-core/io/gzio.c b/grub-core/io/gzio.c
index 8f23a1705..7f7985214 100644
--- a/grub-core/io/gzio.c
+++ b/grub-core/io/gzio.c
@@ -522,7 +522,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
-- 
2.39.3 (Apple Git-145)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]