journal-importer: cap field size when checking
Originally reported on yeswehack.com as YWH-PGM9780-82
Follow-up for 1e448731f5
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
ce31ff043e
commit
5d31694318
@@ -325,7 +325,7 @@ int journal_importer_process_data(JournalImporter *imp) {
|
||||
if (!journal_field_valid(line, sep - line, true)) {
|
||||
char buf[64], *t;
|
||||
|
||||
t = strndupa_safe(line, sep - line);
|
||||
t = strndupa_safe(line, MIN((size_t) (sep - line), sizeof buf));
|
||||
log_debug("Ignoring invalid field: \"%s\"",
|
||||
cellescape(buf, sizeof buf, t));
|
||||
|
||||
@@ -344,7 +344,7 @@ int journal_importer_process_data(JournalImporter *imp) {
|
||||
if (!journal_field_valid(line, n - 1, true)) {
|
||||
char buf[64], *t;
|
||||
|
||||
t = strndupa_safe(line, n - 1);
|
||||
t = strndupa_safe(line, MIN(n - 1, sizeof buf));
|
||||
log_debug("Ignoring invalid field: \"%s\"",
|
||||
cellescape(buf, sizeof buf, t));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user