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:
Luca Boccassi
2026-06-07 21:49:43 +02:00
committed by Zbigniew Jędrzejewski-Szmek
parent ce31ff043e
commit 5d31694318
2 changed files with 14 additions and 2 deletions
+2 -2
View File
@@ -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));