[PATCH 25/28] batctl: bisect_iv: handle failed node_get for RT_FLAG_DELETE

Sven Eckelmann <[email protected]> Sun, 21 Jun 2026 16:24:15 +0200
Newsgroups org.open-mesh.lists.batman
Message-ID <[email protected]>
When a node could not be found or allocated, then node_get() will return
NULL. If this is not checked then it will cause NULL-ptr dereferences in
the seqno_event->orig is accessed.

Fixes: 700749a4c2f4 ("[batctl] add recursive check for routing loops")
Signed-off-by: Sven Eckelmann <[email protected]>
---
 bisect_iv.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/bisect_iv.c b/bisect_iv.c
index f1ba94e..0e34d37 100644
--- a/bisect_iv.c
+++ b/bisect_iv.c
@@ -311,6 +311,11 @@ static int routing_table_new(char *orig, char *next_hop, char *old_next_hop, cha
 			}
 
 			seqno_event->orig = node_get(orig);
+			if (!seqno_event->orig) {
+				free(seqno_event);
+				goto rt_hist_free;
+			}
+
 			seqno_event->neigh = NULL;
 			seqno_event->prev_sender = NULL;
 			seqno_event->seqno = -1;

-- 
2.47.3