anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0408-If-the-notification-message-length-is-0-ignore-the-m.patch

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