summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>2025-01-06 15:35:30 +0100
committerMartin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>2025-01-08 13:30:40 +0100
commit59ee9d2a796ea9ad4fc55ee5df69fd6b0218a887 (patch)
treebec07918f5c5bc2ab89df55af995c8383a3e106f
parent9951da394abb71c6542f91031ac3a9fab04193bd (diff)
lib: Handle call to zlog_5424_cycle() without valid FD properly
In zlog_5424_cycle(), struct zlt_5424 *zlt only points to valid memory when the passed file descriptor is >= 0 (and passing -1 seems to be a supported use case). So we shouldn't try to compute the address of its zt member when zlt is NULL. Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
-rw-r--r--lib/zlog_5424.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/zlog_5424.c b/lib/zlog_5424.c
index c8586a1a02..6265ce3b1f 100644
--- a/lib/zlog_5424.c
+++ b/lib/zlog_5424.c
@@ -782,7 +782,7 @@ static void zlog_5424_cycle(struct zlog_cfg_5424 *zcf, int fd)
}
old = zcf->active ? &zcf->active->zt : NULL;
- old = zlog_target_replace(old, &zlt->zt);
+ old = zlog_target_replace(old, zlt ? &zlt->zt : NULL);
zcf->active = zlt;
/* oldt->fd == fd happens for zlog_5424_apply_meta() */