diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-11-02 12:02:53 -0600 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-11-02 20:10:58 -0400 |
commit | 07ecca0dc9d2d8f3b3abd73ab32f254f339fd903 (patch) | |
tree | 69c02779b533b8ffd540988a1aeca7cba0796a5e | |
parent | 0cc6064c3c2ea8e61298ff3b4a49ad63461db9ea (diff) |
core: don't hit an assert when printing status messages about units with overly long description strings
This essentially reverts one part of d054f0a4d451120c26494263fc4dc175bfd405b1.
(We might also choose to use proper ellipsation here, but I wasn't sure the
memory allocation this requires wouöld be a good idea here...)
Fixes: #4534
-rw-r--r-- | src/core/job.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/job.c b/src/core/job.c index 3ecc8a1a73..d8b170b983 100644 --- a/src/core/job.c +++ b/src/core/job.c @@ -767,8 +767,9 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) { if (!format) return; + /* The description might be longer than the buffer, but that's OK, we'll just truncate it here */ DISABLE_WARNING_FORMAT_NONLITERAL; - xsprintf(buf, format, unit_description(u)); + snprintf(buf, sizeof(buf), format, unit_description(u)); REENABLE_WARNING; switch (t) { |