Skip to content

Commit

Permalink
journal-gatewayd: fix segfault with certain request (systemd#3893)
Browse files Browse the repository at this point in the history
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 systemd#3873.
(cherry picked from commit 3475fc5)
  • Loading branch information
eungjun-yi authored and Michael Chapman committed May 9, 2017
1 parent d7adcd1 commit 87bfd8b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/journal-remote/journal-gatewayd.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,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;
Expand Down

0 comments on commit 87bfd8b

Please sign in to comment.