richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
803fb7
From cd238111a7980917e04cfdc5dae144d1fb4c0a49 Mon Sep 17 00:00:00 2001
803fb7
From: Jorge Niedbalski <jorge.niedbalski@canonical.com>
803fb7
Date: Wed, 28 Sep 2016 18:25:50 -0300
803fb7
Subject: [PATCH] If the notification message length is 0, ignore the message
803fb7
 (#4237)
803fb7
803fb7
Fixes #4234.
803fb7
803fb7
Signed-off-by: Jorge Niedbalski <jnr@metaklass.org>
803fb7
803fb7
Cherry-picked from: 531ac2b2349da02acc9c382849758e07eb92b020
803fb7
Resolves: #1380175
803fb7
---
803fb7
 src/core/manager.c | 4 ++++
803fb7
 1 file changed, 4 insertions(+)
803fb7
803fb7
diff --git a/src/core/manager.c b/src/core/manager.c
803fb7
index 71dd70c94..689b26615 100644
803fb7
--- a/src/core/manager.c
803fb7
+++ b/src/core/manager.c
803fb7
@@ -1678,6 +1678,10 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t
803fb7
 
803fb7
                 return -errno;
803fb7
         }
803fb7
+        if (n == 0) {
803fb7
+                log_debug("Got zero-length notification message. Ignoring.");
803fb7
+                return 0;
803fb7
+        }
803fb7
 
803fb7
         CMSG_FOREACH(cmsg, &msghdr) {
803fb7
                 if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) {