summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2020-12-15 20:44:31 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-12-15 20:56:35 +0100
commitf2bd032044ca3cd4b454dd0ba86719effcf34dc0 (patch)
tree29851ab47eb6042a943e888877721eb4ae0c0826
parentjournal: move journal_field_valid() to journal_file.c (diff)
downloadsystemd-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.c3
-rw-r--r--test/fuzz/fuzz-journal-remote/oss-fuzz-25353bin0 -> 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
new file mode 100644
index 0000000000..94e5fbb93e
--- /dev/null
+++ b/test/fuzz/fuzz-journal-remote/oss-fuzz-25353
Binary files differ