summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-04-20 14:28:19 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-04-21 13:39:50 -0400
commitae2173d66b8b9fc42f311d8586a3cf4abcc65a76 (patch)
tree9ed930bbbb4ae22b57d7d60da60f847716710768
parent93484b4790e261ac3dab12cba5b20d33c74a9202 (diff)
coredump: fix non-literal string used in printf
This was exposed by the previous commit. This could be potentially unpleasant, but we are saved by the fact that this code path was only taken for journald crashes, where we control COMM and know that it doesn't contain any special characters. Use log_dispatch which does not do any format processing to push the message out.
-rw-r--r--src/coredump/coredump.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c
index 5828e949e3..e9ada8e6db 100644
--- a/src/coredump/coredump.c
+++ b/src/coredump/coredump.c
@@ -800,12 +800,11 @@ log:
if (journald_crash) {
/* We cannot log to the journal, so just print the MESSAGE.
* The target was set previously to something safe. */
- log_struct(LOG_ERR, core_message, NULL);
+ log_dispatch(LOG_ERR, 0, core_message);
return 0;
}
- if (core_message)
- IOVEC_SET_STRING(iovec[n_iovec++], core_message);
+ IOVEC_SET_STRING(iovec[n_iovec++], core_message);
if (truncated)
IOVEC_SET_STRING(iovec[n_iovec++], "COREDUMP_TRUNCATED=1");