Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:Update
systemd.9833
0004-journal-remote-set-a-limit-on-the-number-o...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0004-journal-remote-set-a-limit-on-the-number-of-fields-i.patch of Package systemd.9833
From 6196d522b1245c8799ef39c915bda359761c0463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Fri, 7 Dec 2018 10:48:10 +0100 Subject: [PATCH 4/4] journal-remote: set a limit on the number of fields in a message Existing use of E2BIG is replaced with ENOBUFS (entry too long), and E2BIG is reused for the new error condition (too many fields). This matches the change done for systemd-journald, hence forming the second part of the fix for CVE-2018-16865 (https://bugzilla.redhat.com/show_bug.cgi?id=1653861). [fbui: adjust context] --- src/journal-remote/journal-remote-parse.c | 2 +- src/journal-remote/journal-remote-write.c | 4 ++++ src/journal-remote/journal-remote.c | 12 +++++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/journal-remote/journal-remote-parse.c b/src/journal-remote/journal-remote-parse.c index 3ff40228a0..6d2c6c9dae 100644 --- a/src/journal-remote/journal-remote-parse.c +++ b/src/journal-remote/journal-remote-parse.c @@ -111,7 +111,7 @@ static int get_line(RemoteSource *source, char **line, size_t *size) { source->scanned = source->filled; if (source->scanned >= DATA_SIZE_MAX) { log_error("Entry is bigger than %u bytes.", DATA_SIZE_MAX); - return -E2BIG; + return -ENOBUFS; } if (source->passive_fd) diff --git a/src/journal-remote/journal-remote-write.c b/src/journal-remote/journal-remote-write.c index d8250378b0..0f8ada7737 100644 --- a/src/journal-remote/journal-remote-write.c +++ b/src/journal-remote/journal-remote-write.c @@ -21,8 +21,12 @@ #include "alloc-util.h" #include "journal-remote.h" +#include "journald-native.h" int iovw_put(struct iovec_wrapper *iovw, void* data, size_t len) { + if (iovw->count >= ENTRY_FIELD_COUNT_MAX) + return -E2BIG; + if (!GREEDY_REALLOC(iovw->iovec, iovw->size_bytes, iovw->count + 1)) return log_oom(); diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index d16be62f35..15e36c9eef 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -531,9 +531,12 @@ static int process_http_upload( if (r == -EAGAIN) break; if (r < 0) { - if (r == -E2BIG) - log_warning_errno(r, "Entry is too above maximum of %u, aborting connection %p.", + if (r == -ENOBUFS) + log_warning_errno(r, "Entry is above the maximum of %u, aborting connection %p.", DATA_SIZE_MAX, connection); + else if (r == -E2BIG) + log_warning_errno(r, "Entry with more fields than the maximum of %u, aborting connection %p.", + ENTRY_FIELD_COUNT_MAX, connection); else log_warning_errno(r, "Failed to process data, aborting connection %p: %m", connection); @@ -1055,7 +1058,10 @@ static int handle_raw_source(sd_event_source *event, log_debug("%zu active sources remaining", s->active); return 0; } else if (r == -E2BIG) { - log_notice_errno(E2BIG, "Entry too big, skipped"); + log_notice("Entry with too many fields, skipped"); + return 1; + } else if (r == -ENOBUFS) { + log_notice("Entry too big, skipped"); return 1; } else if (r == -EAGAIN) { return 0; -- 2.19.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor