|
|
36e8a3 |
From fde3fa3e9c0330c7de645ce2140f9dd39640a693 Mon Sep 17 00:00:00 2001
|
|
|
36e8a3 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
|
36e8a3 |
Date: Fri, 7 Dec 2018 10:48:10 +0100
|
|
|
36e8a3 |
Subject: [PATCH] journal-remote: set a limit on the number of fields in a
|
|
|
36e8a3 |
message
|
|
|
36e8a3 |
|
|
|
36e8a3 |
Existing use of E2BIG is replaced with ENOBUFS (entry too long), and E2BIG is
|
|
|
36e8a3 |
reused for the new error condition (too many fields).
|
|
|
36e8a3 |
|
|
|
36e8a3 |
This matches the change done for systemd-journald, hence forming the second
|
|
|
36e8a3 |
part of the fix for CVE-2018-16865
|
|
|
36e8a3 |
(https://bugzilla.redhat.com/show_bug.cgi?id=1653861).
|
|
|
36e8a3 |
|
|
|
36e8a3 |
(cherry-picked from commit ef4d6abe7c7fab6cbff975b32e76b09feee56074)
|
|
|
36e8a3 |
|
|
|
36e8a3 |
Resolves: #1664977
|
|
|
36e8a3 |
---
|
|
|
36e8a3 |
src/journal-remote/journal-remote-main.c | 7 +++++--
|
|
|
36e8a3 |
src/journal-remote/journal-remote.c | 5 ++++-
|
|
|
36e8a3 |
2 files changed, 9 insertions(+), 3 deletions(-)
|
|
|
36e8a3 |
|
|
|
36e8a3 |
diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c
|
|
|
36e8a3 |
index e9b3702e8..5b0bbba31 100644
|
|
|
36e8a3 |
--- a/src/journal-remote/journal-remote-main.c
|
|
|
36e8a3 |
+++ b/src/journal-remote/journal-remote-main.c
|
|
|
36e8a3 |
@@ -211,9 +211,12 @@ static int process_http_upload(
|
|
|
36e8a3 |
if (r == -EAGAIN)
|
|
|
36e8a3 |
break;
|
|
|
36e8a3 |
if (r < 0) {
|
|
|
36e8a3 |
- if (r == -E2BIG)
|
|
|
36e8a3 |
- log_warning_errno(r, "Entry is too above maximum of %u, aborting connection %p.",
|
|
|
36e8a3 |
+ if (r == -ENOBUFS)
|
|
|
36e8a3 |
+ log_warning_errno(r, "Entry is above the maximum of %u, aborting connection %p.",
|
|
|
36e8a3 |
DATA_SIZE_MAX, connection);
|
|
|
36e8a3 |
+ else if (r == -E2BIG)
|
|
|
36e8a3 |
+ log_warning_errno(r, "Entry with more fields than the maximum of %u, aborting connection %p.",
|
|
|
36e8a3 |
+ ENTRY_FIELD_COUNT_MAX, connection);
|
|
|
36e8a3 |
else
|
|
|
36e8a3 |
log_warning_errno(r, "Failed to process data, aborting connection %p: %m",
|
|
|
36e8a3 |
connection);
|
|
|
36e8a3 |
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c
|
|
|
36e8a3 |
index beb75a1cb..67e3a70c0 100644
|
|
|
36e8a3 |
--- a/src/journal-remote/journal-remote.c
|
|
|
36e8a3 |
+++ b/src/journal-remote/journal-remote.c
|
|
|
36e8a3 |
@@ -408,7 +408,10 @@ int journal_remote_handle_raw_source(
|
|
|
36e8a3 |
log_debug("%zu active sources remaining", s->active);
|
|
|
36e8a3 |
return 0;
|
|
|
36e8a3 |
} else if (r == -E2BIG) {
|
|
|
36e8a3 |
- log_notice_errno(E2BIG, "Entry too big, skipped");
|
|
|
36e8a3 |
+ log_notice("Entry with too many fields, skipped");
|
|
|
36e8a3 |
+ return 1;
|
|
|
36e8a3 |
+ } else if (r == -ENOBUFS) {
|
|
|
36e8a3 |
+ log_notice("Entry too big, skipped");
|
|
|
36e8a3 |
return 1;
|
|
|
36e8a3 |
} else if (r == -EAGAIN) {
|
|
|
36e8a3 |
return 0;
|