diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2025-08-11 06:26:54 +0200 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2025-08-11 10:17:14 +0200 |
commit | 1c9f509cdaf0233ae4848c05c8bcd0de98bde89a (patch) | |
tree | a4dcbc671f7e76e04824c460b9a9649b1753abbe /src/ipcpd/unicast/dt.c | |
parent | 5c9328203b277fc36550ba06720dd13e5940121b (diff) | |
download | ouroboros-1c9f509cdaf0233ae4848c05c8bcd0de98bde89a.tar.gz ouroboros-1c9f509cdaf0233ae4848c05c8bcd0de98bde89a.zip |
ipcpd: Fix readdir() not initializing ptrbe
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 <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/ipcpd/unicast/dt.c')
-rw-r--r-- | src/ipcpd/unicast/dt.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ipcpd/unicast/dt.c b/src/ipcpd/unicast/dt.c index 38cee75d..5dac70e9 100644 --- a/src/ipcpd/unicast/dt.c +++ b/src/ipcpd/unicast/dt.c @@ -287,8 +287,10 @@ static int dt_rib_readdir(char *** buf) pthread_rwlock_rdlock(&dt.lock); - if (dt.n_flows < 1) + if (dt.n_flows < 1) { + *buf = NULL; goto no_flows; + } *buf = malloc(sizeof(**buf) * dt.n_flows); if (*buf == NULL) |