X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fservice.c;h=8b5c0b07c4d29efe70b639936389d7b77a2dbdbb;hb=9631c090fd61070797f3a6139f873a3cabc5d28a;hp=babd9cf9a550b4892413855ef22d75d20876218c;hpb=6bda96a0234e2d3d61bc36de99c19a9293721fef;p=elogind.git diff --git a/src/service.c b/src/service.c index babd9cf9a..8b5c0b07c 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; }