Skip to content

Commit

Permalink
Merge pull request #1523 from furiel/invalid-read
Browse files Browse the repository at this point in the history
Invalid read in system source/nvtable and in file destination
  • Loading branch information
bazsi committed Jun 14, 2017
2 parents 1b3145a + 559be1f commit c6bf2e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/logwriter.c
Expand Up @@ -1357,6 +1357,9 @@ log_writer_deinit(LogPipe *s)
log_writer_stop_watches(self);
iv_event_unregister(&self->queue_filled);

if (iv_timer_registered(&self->reopen_timer))
iv_timer_unregister(&self->reopen_timer);

ml_batched_timer_unregister(&self->suppress_timer);
ml_batched_timer_unregister(&self->mark_timer);

Expand Down
8 changes: 6 additions & 2 deletions modules/systemd-journal/journal-reader.c
Expand Up @@ -224,17 +224,21 @@ static void
_set_program(JournalReaderOptions *options, LogMessage *msg)
{
gssize value_length = 0;
const gchar *value = _get_value_from_message(options, msg, "SYSLOG_IDENTIFIER", &value_length);
/* g_strdup: referred value can change during log_msg_set_value if nvtable realloc needed */
gchar *value = g_strdup(_get_value_from_message(options, msg, "SYSLOG_IDENTIFIER", &value_length));

if (value_length > 0)
{
log_msg_set_value(msg, LM_V_PROGRAM, value, value_length);
}
else
{
value = _get_value_from_message(options, msg, "_COMM", &value_length);
value = g_strdup(_get_value_from_message(options, msg, "_COMM", &value_length));
log_msg_set_value(msg, LM_V_PROGRAM, value, value_length);
}

g_free(value);

}

static void
Expand Down

0 comments on commit c6bf2e2

Please sign in to comment.