From: Lennart Poettering Date: Tue, 21 Jan 2020 09:49:58 +0000 (+0100) Subject: journal: don't use startswith() on something that is not a NUL-terminated string X-Git-Tag: v245-rc1~99 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e0567bc8adfe027052b78b40efb57d543924f138;p=thirdparty%2Fsystemd.git journal: don't use startswith() on something that is not a NUL-terminated string Otherwise we might access memory coming after it that is not valid or allocated. Fixes: #14114 --- diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index 358f2fd738e..837aecdf605 100644 --- a/src/journal/sd-journal.c +++ b/src/journal/sd-journal.c @@ -161,7 +161,7 @@ static int match_is_valid(const void *data, size_t size) { if (size < 2) return false; - if (startswith(data, "__")) + if (((char*) data)[0] == '_' && ((char*) data)[1] == '_') return false; b = data;