systemd/0036-conf-parser-fix-wrong-argument-given-to-log_syntax_i.patch
Zbigniew Jędrzejewski-Szmek d743bb5bcc Revert "Build with meson"
This reverts commits 3fb4a15096
and 0e8350ca14.

Either building with meson or other upstream changes was causing
issues with booting, and I didn't have time to debug this properly.
2017-06-27 13:42:28 -04:00

47 lines
1.9 KiB
Diff

From 8061fde2d95f0b67d299815a5944abeed0b1ee46 Mon Sep 17 00:00:00 2001
From: Ronny Chevalier <chevalier.ronny@gmail.com>
Date: Sun, 14 May 2017 13:19:11 +0200
Subject: [PATCH] conf-parser: fix wrong argument given to
log_syntax_invalid_utf8
The condition is on "word", hence we give word instead of rvalue.
An assert would be triggered if !utf8_is_valid(word) is true and
rvalue == NULL, since log_syntax_invalid_utf8 calls utf8_escape_invalid
which calls assert(str).
A test case has been added to test with valid and invalid utf8.
(cherry picked from commit b4958f42af08a72cf02e845c8db8d60fe2e5a82f)
---
src/shared/conf-parser.c | 2 +-
src/test/test-conf-parser.c | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index 265ac83dc0..863034d18a 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -792,7 +792,7 @@ int config_parse_strv(const char *unit,
}
if (!utf8_is_valid(word)) {
- log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, rvalue);
+ log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, word);
free(word);
continue;
}
diff --git a/src/test/test-conf-parser.c b/src/test/test-conf-parser.c
index be5d2611f8..26ff27035b 100644
--- a/src/test/test-conf-parser.c
+++ b/src/test/test-conf-parser.c
@@ -180,6 +180,8 @@ static void test_config_parse_strv(void) {
test_config_parse_strv_one("foo", STRV_MAKE("foo"));
test_config_parse_strv_one("foo bar foo", STRV_MAKE("foo", "bar", "foo"));
test_config_parse_strv_one("\"foo bar\" foo", STRV_MAKE("foo bar", "foo"));
+ test_config_parse_strv_one("\xc3\x80", STRV_MAKE("\xc3\x80"));
+ test_config_parse_strv_one("\xc3\x7f", STRV_MAKE_EMPTY);
}
static void test_config_parse_mode(void) {