diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-12-15 20:44:31 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-12-15 20:56:35 +0100 |
commit | f2bd032044ca3cd4b454dd0ba86719effcf34dc0 (patch) | |
tree | 29851ab47eb6042a943e888877721eb4ae0c0826 | |
parent | journal: move journal_field_valid() to journal_file.c (diff) | |
download | systemd-f2bd032044ca3cd4b454dd0ba86719effcf34dc0.tar.xz systemd-f2bd032044ca3cd4b454dd0ba86719effcf34dc0.zip |
journal: refuse data which contain invalid fields
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25353.
-rw-r--r-- | src/journal/journal-file.c | 3 | ||||
-rw-r--r-- | test/fuzz/fuzz-journal-remote/oss-fuzz-25353 | bin | 0 -> 45 bytes |
2 files changed, 3 insertions, 0 deletions
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index 18dc3072b4..fa117ab63c 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -1572,6 +1572,9 @@ static int journal_file_append_field( assert(f); assert(field && size > 0); + if (!journal_field_valid(field, size, true)) + return -EBADMSG; + hash = journal_file_hash_data(f, field, size); r = journal_file_find_field_object_with_hash(f, field, size, hash, &o, &p); diff --git a/test/fuzz/fuzz-journal-remote/oss-fuzz-25353 b/test/fuzz/fuzz-journal-remote/oss-fuzz-25353 Binary files differnew file mode 100644 index 0000000000..94e5fbb93e --- /dev/null +++ b/test/fuzz/fuzz-journal-remote/oss-fuzz-25353 |