fix: zero correct byte count in expand_workspace_real()

memset(p+old, 0, new-old) was missing the sizeof(unsigned char *)
multiplier.  p is unsigned char**, so each slot is pointer-sized (8
instead of 1 byte on 64-bit), yet only new-old bytes were zeroed,
leaving newly allocated DNSSEC workspace pointer slots with garbage values.

Signed-off-by: Dominik <dl6er@dl6er.de>
This commit is contained in:
Dominik authored and Simon Kelley committed 2026-03-30 17:31:20 +01:00
1 parent b95d5a2577
commit 5ea054b264
1 file changed
+1 -1
+1 -1
View File
@@ -991,7 +991,7 @@ int expand_workspace_real(const char *func, unsigned int line, unsigned char ***
if (!(p = whine_realloc_real("expand_workspace", func, line, *wkspc, new * sizeof(unsigned char *))))
return 0;
memset(p+old, 0, new-old);
memset(p+old, 0, (new-old) * sizeof(unsigned char *));
*wkspc = p;
*szp = new;