summaryrefslogtreecommitdiff
path: root/src/service.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-03-12 22:22:16 +0100
committerLennart Poettering <lennart@poettering.net>2012-03-12 22:22:21 +0100
commit7f110ff9b8828b477e87de7b28c708cf69a3d008 (patch)
tree651d0f8f32ce086872f1e262bb8caee795a04c67 /src/service.c
parent669e49fe2c841e53f7f2196bbe5d614013429ecd (diff)
conf: enforce UTF8 validty everywhere
we need to make sure that configuration data we expose via the bus ends up in using getting an assert(). Even though configuration data is only parsed from trusted sources we should be more careful with what we read.
Diffstat (limited to 'src/service.c')
-rw-r--r--src/service.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/service.c b/src/service.c
index babd9cf9a5..8b5c0b07c4 100644
--- a/src/service.c
+++ b/src/service.c
@@ -39,6 +39,7 @@
#include "exit-status.h"
#include "def.h"
#include "util.h"
+#include "utf8.h"
#ifdef HAVE_SYSV_COMPAT
@@ -3200,11 +3201,19 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
}
/* Interpret STATUS= */
- if ((e = strv_find_prefix(tags, "STATUS="))) {
+ e = strv_find_prefix(tags, "STATUS=");
+ if (e) {
char *t;
if (e[7]) {
- if (!(t = strdup(e+7))) {
+
+ if (!utf8_is_valid(e+7)) {
+ log_warning("Status message in notification is not UTF-8 clean.");
+ return;
+ }
+
+ t = strdup(e+7);
+ if (!t) {
log_error("Failed to allocate string.");
return;
}