]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: don't hit an assert when printing status messages about units with overly long...
authorLennart Poettering <lennart@poettering.net>
Wed, 2 Nov 2016 18:02:53 +0000 (12:02 -0600)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 3 Nov 2016 00:10:58 +0000 (20:10 -0400)
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
src/core/job.c

index 3ecc8a1a73b3dc49889a52dbc692d1ee26091a6c..d8b170b98323c08b3e424461bf6b9a58ba8764d0 100644 (file)
@@ -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) {