diff options
author | Tomas Heinrich <theinric@redhat.com> | 2013-06-07 01:15:10 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-06-10 08:06:35 +0200 |
commit | fc72c6cccc1e1e267c063e384a900a8987a8f14e (patch) | |
tree | dc52829825d5f0b01488d2428bea9fff73bccfe8 /plugins/imjournal/imjournal.c | |
parent | 47866030196626d42faa68c92ee59c0b81a481f0 (diff) | |
download | rsyslog-fc72c6cccc1e1e267c063e384a900a8987a8f14e.tar.gz rsyslog-fc72c6cccc1e1e267c063e384a900a8987a8f14e.tar.bz2 rsyslog-fc72c6cccc1e1e267c063e384a900a8987a8f14e.zip |
bugfix: be more tolerant to malformed journal fields
This prevents a segfault when a malformed journal entry field doesn't
contain an equal sign. Should not ever happen but was actually
triggered by a real bug in systemd journal.
Diffstat (limited to 'plugins/imjournal/imjournal.c')
-rwxr-xr-x | plugins/imjournal/imjournal.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c index ae29154d..cce45b9c 100755 --- a/plugins/imjournal/imjournal.c +++ b/plugins/imjournal/imjournal.c @@ -244,7 +244,14 @@ readjournal() { SD_JOURNAL_FOREACH_DATA(j, get, l) { /* locate equal sign, this is always present */ equal_sign = memchr(get, '=', l); - assert (equal_sign != NULL); + + /* ... but we know better than to trust the specs */ + if (equal_sign == NULL) { + errmsg.LogError(0, RS_RET_ERR,"SD_JOURNAL_FOREACH_DATA()" + " returned a malformed field (has no '='): '%s'", + get); + continue; /* skip the entry */ + } /* get length of journal data prefix */ prefixlen = ((char *)equal_sign - (char *)get); |