Blame SOURCES/0265-journald-take-leading-spaces-into-account-in-syslog_.patch

ddca0b
From 3521217c88b364e2c5b10a1e35d3c036b1ecba64 Mon Sep 17 00:00:00 2001
ddca0b
From: Evgeny Vereshchagin <evvers@ya.ru>
ddca0b
Date: Fri, 10 Aug 2018 12:55:09 +0000
ddca0b
Subject: [PATCH] journald: take leading spaces into account in
ddca0b
 syslog_parse_identifier
ddca0b
ddca0b
This is a kind of follow-up to e88baee88fad8bc59d3 which should finally fix
ddca0b
the issue which that commit was supposed to fix.
ddca0b
ddca0b
(cherry picked from commit 937b1171378bc1000a34fcdfe9534d898227e35f)
ddca0b
ddca0b
Resolves: #1764560
ddca0b
---
ddca0b
 src/journal/journald-syslog.c     | 3 ++-
ddca0b
 src/journal/test-journal-syslog.c | 2 ++
ddca0b
 2 files changed, 4 insertions(+), 1 deletion(-)
ddca0b
ddca0b
diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c
ddca0b
index e0b55cc566..ae966763a0 100644
ddca0b
--- a/src/journal/journald-syslog.c
ddca0b
+++ b/src/journal/journald-syslog.c
ddca0b
@@ -223,8 +223,9 @@ size_t syslog_parse_identifier(const char **buf, char **identifier, char **pid)
ddca0b
         if (p[e] != '\0' && strchr(WHITESPACE, p[e]))
ddca0b
                 e++;
ddca0b
 
ddca0b
+        l = (p - *buf) + e;
ddca0b
         *buf = p + e;
ddca0b
-        return e;
ddca0b
+        return l;
ddca0b
 }
ddca0b
 
ddca0b
 static void syslog_skip_date(char **buf) {
ddca0b
diff --git a/src/journal/test-journal-syslog.c b/src/journal/test-journal-syslog.c
ddca0b
index 120477cc9f..415b9d23ca 100644
ddca0b
--- a/src/journal/test-journal-syslog.c
ddca0b
+++ b/src/journal/test-journal-syslog.c
ddca0b
@@ -41,6 +41,8 @@ int main(void) {
ddca0b
         test_syslog_parse_identifier("  ", NULL, NULL, "  ", 0);
ddca0b
         test_syslog_parse_identifier(":", "", NULL, "", 1);
ddca0b
         test_syslog_parse_identifier(":  ", "", NULL, " ", 2);
ddca0b
+        test_syslog_parse_identifier(" :", "", NULL, "", 2);
ddca0b
+        test_syslog_parse_identifier("   pidu:", "pidu", NULL, "", 8);
ddca0b
         test_syslog_parse_identifier("pidu:", "pidu", NULL, "", 5);
ddca0b
         test_syslog_parse_identifier("pidu: ", "pidu", NULL, "", 6);
ddca0b
         test_syslog_parse_identifier("pidu : ", NULL, NULL, "pidu : ", 0);