summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/journal/journal-file.h3
-rw-r--r--src/journal/journald-native.c5
2 files changed, 8 insertions, 0 deletions
diff --git a/src/journal/journal-file.h b/src/journal/journal-file.h
index c8114ee2d0..cd8a48a364 100644
--- a/src/journal/journal-file.h
+++ b/src/journal/journal-file.h
@@ -165,6 +165,9 @@ int journal_file_open_reliably(
* files without adding too many zeros. */
#define OFSfmt "%06"PRIx64
+/* The maximum number of fields in an entry */
+#define ENTRY_FIELD_COUNT_MAX 1024
+
static inline bool VALID_REALTIME(uint64_t u) {
/* This considers timestamps until the year 3112 valid. That should be plenty room... */
return u > 0 && u < (1ULL << 55);
diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c
index 5ff22a10af..951d092053 100644
--- a/src/journal/journald-native.c
+++ b/src/journal/journald-native.c
@@ -140,6 +140,11 @@ static int server_process_entry(
}
/* A property follows */
+ if (n > ENTRY_FIELD_COUNT_MAX) {
+ log_debug("Received an entry that has more than " STRINGIFY(ENTRY_FIELD_COUNT_MAX) " fields, ignoring entry.");
+ r = 1;
+ goto finish;
+ }
/* n existing properties, 1 new, +1 for _TRANSPORT */
if (!GREEDY_REALLOC(iovec, m,