From: Luca Boccassi Date: Thu, 1 Apr 2021 21:18:29 +0000 (+0100) Subject: LoadCredentials: do not assert on invalid syntax X-Git-Tag: archive/raspbian/247.3-5+rpi1^2~24 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=9a749dc3c225ed1ed9f4524487da79ad44180d9b;p=systemd.git LoadCredentials: do not assert on invalid syntax LoadCredentials=foo causes an assertion to be triggered, as we are not checking that the rvalue's right hand side part is non-empty before using it in unit_full_printf. Fixes #19178 # printf [Service]nLoadCredential=passwd.hashed-password.rootn > hello.service # systemd-analyze verify ./hello.service ... Assertion 'format' failed at src/core/unit-printf.c:232, function unit_full_printf(). Aborting. Aborted (core dumped) (cherry picked from commit f7a6f1226e800f7695c2073675523062ea697aa4) Gbp-Pq: Name LoadCredentials-do-not-assert-on-invalid-syntax.patch --- diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 4964249b..5b66fb16 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -4569,7 +4569,7 @@ int config_parse_load_credential( r = extract_first_word(&p, &word, ":", EXTRACT_DONT_COALESCE_SEPARATORS); if (r == -ENOMEM) return log_oom(); - if (r <= 0) { + if (r <= 0 || isempty(p)) { log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid syntax, ignoring: %s", rvalue); return 0; }