[PATCH 24/28] batctl: bisect_iv: avoid access of uninitialized loop magic

Sven Eckelmann <[email protected]> Sun, 21 Jun 2026 16:24:14 +0200
Newsgroups org.open-mesh.lists.batman
Message-ID <[email protected]>
The loop magic string is initialized with snprintf - which can be a partial
initialization. But the rest of the access assumes that all of the loop
magic is initialized because it is then only access with memcmp and memcpy.

Initialize everything to 0 at the beginning of the function to avoid
uninitialized bytes.

Fixes: ece05e1c4c1f ("[batctl] bisect (a tool to analyze logfiles) added")
Signed-off-by: Sven Eckelmann <[email protected]>
---
 bisect_iv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bisect_iv.c b/bisect_iv.c
index 5da5bf1..f1ba94e 100644
--- a/bisect_iv.c
+++ b/bisect_iv.c
@@ -658,7 +658,7 @@ static int print_rt_path_at_seqno(struct bat_node *src_node, struct bat_node *ds
 				  struct bat_node *next_hop, long long seqno,
 				  long long seqno_rand, int read_opt)
 {
-	char curr_loop_magic[LOOP_MAGIC_LEN];
+	char curr_loop_magic[LOOP_MAGIC_LEN] = {};
 	struct bat_node *next_hop_tmp;
 	struct orig_event *orig_event;
 	struct rt_hist *rt_hist;
@@ -720,7 +720,7 @@ static int find_rt_table_change(struct bat_node *src_node, struct bat_node *dst_
 				struct bat_node *curr_node, long long seqno_min,
 				long long seqno_max, long long seqno_rand, int read_opt)
 {
-	char curr_loop_magic[LOOP_MAGIC_LEN];
+	char curr_loop_magic[LOOP_MAGIC_LEN] = {};
 	long long seqno_min_tmp = seqno_min;
 	struct orig_event *orig_event;
 	struct rt_hist *rt_hist_tmp;

-- 
2.47.3