Zbigniew Jędrzejewski-Szmek | 3a5d9b7 | 2016-09-29 17:04:15 -0400 | [diff] [blame] | 1 | From 2e9b525caa9e3126e54f0d9506d0c36d7d533997 Mon Sep 17 00:00:00 2001 |
Zbigniew Jędrzejewski-Szmek | 20fa848 | 2016-09-29 05:34:51 -0400 | [diff] [blame] | 2 | From: Jorge Niedbalski <jorge.niedbalski@canonical.com> |
| 3 | Date: Wed, 28 Sep 2016 18:25:50 -0300 |
| 4 | Subject: [PATCH] If the notification message length is 0, ignore the message |
| 5 | (#4237) |
| 6 | |
| 7 | Fixes #4234. |
| 8 | |
| 9 | Signed-off-by: Jorge Niedbalski <jnr@metaklass.org> |
Zbigniew Jędrzejewski-Szmek | 3a5d9b7 | 2016-09-29 17:04:15 -0400 | [diff] [blame] | 10 | (cherry picked from commit 531ac2b2349da02acc9c382849758e07eb92b020) |
Zbigniew Jędrzejewski-Szmek | 20fa848 | 2016-09-29 05:34:51 -0400 | [diff] [blame] | 11 | --- |
| 12 | src/core/manager.c | 4 ++++ |
| 13 | 1 file changed, 4 insertions(+) |
| 14 | |
| 15 | diff --git a/src/core/manager.c b/src/core/manager.c |
| 16 | index 4d84a0b37e..a085ed899a 100644 |
| 17 | --- a/src/core/manager.c |
| 18 | +++ b/src/core/manager.c |
| 19 | @@ -1648,6 +1648,10 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t |
| 20 | |
| 21 | return -errno; |
| 22 | } |
| 23 | + if (n == 0) { |
| 24 | + log_debug("Got zero-length notification message. Ignoring."); |
| 25 | + return 0; |
| 26 | + } |
| 27 | |
| 28 | CMSG_FOREACH(cmsg, &msghdr) { |
| 29 | if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) { |