journal-importer: ignore invalid field at one more place

Fixes oss-fuzz#28817.
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28817
This commit is contained in:
Yu Watanabe 2020-12-21 16:33:20 +09:00 committed by Luca Boccassi
parent 3d909037e3
commit 8786d4bbe4
2 changed files with 10 additions and 0 deletions

View File

@ -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] = '=';

Binary file not shown.