From 1c9f509cdaf0233ae4848c05c8bcd0de98bde89a Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Mon, 11 Aug 2025 06:26:54 +0200 Subject: ipcpd: Fix readdir() not initializing ptr Some IPCP (sub)components returned successfully with 0 entries but did not initialize the buf ptr when the RIB has no entries, causing a SEGV on free() in the RIB. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/ipcpd/unicast/fa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/ipcpd/unicast/fa.c') diff --git a/src/ipcpd/unicast/fa.c b/src/ipcpd/unicast/fa.c index 61abff52..23676c23 100644 --- a/src/ipcpd/unicast/fa.c +++ b/src/ipcpd/unicast/fa.c @@ -217,8 +217,10 @@ static int fa_rib_readdir(char *** buf) pthread_rwlock_rdlock(&fa.flows_lock); - if (fa.n_flows < 1) + if (fa.n_flows < 1) { + *buf = NULL; goto no_flows; + } *buf = malloc(sizeof(**buf) * fa.n_flows); if (*buf == NULL) -- cgit v1.2.3