summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYi EungJun <semtlenori@gmail.com>2016-08-07 05:39:13 +0900
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-08-06 16:39:13 -0400
commit3475fc5899db8c8c9198573912429b85213e4862 (patch)
treec375f7d0d059fd2fbf48e03a979561c407e06043 /src
parent1aa1e59c7f34acdbd1af7c18e1fc471e5b92ed85 (diff)
journal-gatewayd: fix segfault with certain request (#3893)
When client requests to get logs with `follow` and `KEY=match` that doesn't match any log entry, journal-gatewayd segfaulted. Make request_reader_entries to return zero in such case to wait for matching entries. This fixes https://github.com/systemd/systemd/issues/3873.
Diffstat (limited to 'src')
-rw-r--r--src/journal-remote/journal-gatewayd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c
index 4d785c819f..05c8698f78 100644
--- a/src/journal-remote/journal-gatewayd.c
+++ b/src/journal-remote/journal-gatewayd.c
@@ -240,6 +240,9 @@ static ssize_t request_reader_entries(
m->size = (uint64_t) sz;
}
+ if (m->tmp == NULL && m->follow)
+ return 0;
+
if (fseeko(m->tmp, pos, SEEK_SET) < 0) {
log_error_errno(errno, "Failed to seek to position: %m");
return MHD_CONTENT_READER_END_WITH_ERROR;