summaryrefslogtreecommitdiffstats
path: root/src/shared/journal-importer.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2020-12-21 08:33:20 +0100
committerLuca Boccassi <luca.boccassi@gmail.com>2020-12-21 13:40:44 +0100
commit8786d4bbe43b5f6493982bcb5211e010f99deb57 (patch)
tree530a92e6f0e870feb48f77ac2cbeab2805bd240a /src/shared/journal-importer.c
parentman/localtime: document default timezone (diff)
downloadsystemd-8786d4bbe43b5f6493982bcb5211e010f99deb57.tar.xz
systemd-8786d4bbe43b5f6493982bcb5211e010f99deb57.zip
journal-importer: ignore invalid field at one more place
Fixes oss-fuzz#28817. https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28817
Diffstat (limited to 'src/shared/journal-importer.c')
-rw-r--r--src/shared/journal-importer.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/shared/journal-importer.c b/src/shared/journal-importer.c
index e95b638f4d..b2785f0552 100644
--- a/src/shared/journal-importer.c
+++ b/src/shared/journal-importer.c
@@ -334,6 +334,16 @@ int journal_importer_process_data(JournalImporter *imp) {
if (r < 0)
return r;
} else {
+ if (!journal_field_valid(line, n - 1, true)) {
+ char buf[64], *t;
+
+ t = strndupa(line, n - 1);
+ log_debug("Ignoring invalid field: \"%s\"",
+ cellescape(buf, sizeof buf, t));
+
+ return 0;
+ }
+
/* replace \n with = */
line[n-1] = '=';