Skip to content

Commit

Permalink
logsource: fix use after free in message processing debug log
Browse files Browse the repository at this point in the history
`log_pipe_forward_msg()` frees `msg`.

Signed-off-by: Attila Szakacs <[email protected]>
Signed-off-by: Szilard Parrag <[email protected]>
  • Loading branch information
alltilla committed Nov 4, 2024
1 parent a967442 commit 7518b92
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/logsource.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,13 @@ log_source_queue(LogPipe *s, LogMessage *msg, const LogPathOptions *path_options

/* message setup finished, send it out */

EVTTAG *msg_tag, *rcptid_tag = NULL;
if (G_UNLIKELY(trace_flag))
{
msg_tag = evt_tag_printf("msg", "%p", (msg));
rcptid_tag = evt_tag_printf("rcptid", "%" G_GUINT64_FORMAT, (msg)->rcptid);
}

stats_counter_inc(self->metrics.recvd_messages);
stats_counter_set_time(self->metrics.last_message_seen, msg->timestamps[LM_TS_RECVD].ut_sec);
stats_byte_counter_add(&self->metrics.recvd_bytes, msg->recvd_rawmsg_size);
Expand All @@ -682,7 +689,8 @@ log_source_queue(LogPipe *s, LogMessage *msg, const LogPathOptions *path_options
}
msg_diagnostics("<<<<<< Source side message processing finish",
log_pipe_location_tag(s),
evt_tag_msg_reference(msg));
msg_tag,
rcptid_tag);

msg_set_context(NULL);
}
Expand Down

0 comments on commit 7518b92

Please sign in to comment.