[systemd-devel] [PATCH] journalctl: verify object size in enumerate_unique

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Tue Aug 26 19:50:10 PDT 2014


On Tue, Aug 26, 2014 at 09:47:54PM +0200, Lennart Poettering wrote:
> On Sat, 23.08.14 22:39, Zbigniew Jędrzejewski-Szmek (zbyszek at in.waw.pl) wrote:
> 
> > We assumed that objects in a unique chain are good enough,
> > and only checked object type. But mmap code crashes when some object
> > has zero size. This most likely is caused by a corrupted journal
> > file, but we should fail gracefully.
> 
> Shouldn't we check the full field name too with memcmp()? I mean, if we
> look at the length we really can also compare the string for good, no?
True, not necessary to fix the crash, but good for correctness.

> But looks good otherwise, except that I dont like "log_error()" being
> invoked from a library. This should be downgraded to
> "log_debug()". Libraries should never write anything to stdout/stderr by
> default...
Yeah, I noticed your commit for sd-journal.c.

I'll fix up the patch and push.

Zbyszek


More information about the systemd-devel mailing list