shared/logs-show: fix mixup between length-based memory duplication and string operations
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 20 May 2018 20:06:23 +0000 (22:06 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 31 May 2018 12:30:23 +0000 (14:30 +0200)
commit324d6aa92629d4368b517f5c4d17a103c69098be
tree1c371592c8e40ee9e5169447347eda0454839636
parent2e69f4114c4a71a874bfee39600d6adc0d0064a5
shared/logs-show: fix mixup between length-based memory duplication and string operations

We'd look for a '=' separator using memchr, i.e. ignoring any nul bytes in the
string, but then do a strndup, which would terminate on any nul byte, and then
again do a memcmp, which would access memory past the chunk allocated by strndup.

Of course, we probably shouldn't allow keys with nul bytes in them. But we
currently do, so there might be journal files like that out there. So let's fix
the journal-reading code first.
src/shared/logs-show.c
test/fuzz-regressions/fuzz-journal-remote/crash-96dee870ea66d03e89ac321eee28ea63a9b9aa45 [new file with mode: 0644]