BUG/MINOR: log: prevent saddr NULL deref in syslog_io_handler()

In ad0133cc ("MINOR: log: handle log-forward "option host""), we
de-reference saddr without first checking if saddr is NULL. In practise
saddr shouldn't be null, but it may be the case if memory error happens
for tcp syslog handler so we must assume that it can be NULL at some
point.

To fix the bug, we simply check for NULL before de-referencing it
under syslog_io_handler(), as the function comment suggests.

No backport needed unless ad0133cc is.
This commit is contained in:
Aurelien DARRAGON 2025-03-18 00:09:59 +01:00
parent 29b4b985c3
commit 7895726bff

View File

@ -5739,7 +5739,7 @@ static void syslog_process_message(struct proxy *frontend, struct listener *l,
parse_log_message(buf->area, buf->data, &level, &facility, metadata, &message, &size);
if (real_family(saddr->ss_family) == AF_UNIX)
if (saddr && real_family(saddr->ss_family) == AF_UNIX)
saddr = NULL; /* no source information for UNIX addresses */
/* handle host options */