ba3644fcee
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=217
48 lines
1.6 KiB
Diff
48 lines
1.6 KiB
Diff
From 5a4d665ad679a8436f1210ba67d713a8f0b91b96 Mon Sep 17 00:00:00 2001
|
|
From: Lennart Poettering <lennart@poettering.net>
|
|
Date: Fri, 14 Mar 2014 21:15:32 +0100
|
|
Subject: [PATCH] sd-bus: don't choke if somebody sends us a message with a
|
|
unix fd count of 0
|
|
|
|
It's kinda pointless to include a unix fd header field in messages if it
|
|
carries the value 0, but let's do this anyway...
|
|
---
|
|
src/libsystemd/sd-bus/bus-message.c | 7 +++----
|
|
1 file changed, 3 insertions(+), 4 deletions(-)
|
|
|
|
diff --git src/libsystemd/sd-bus/bus-message.c src/libsystemd/sd-bus/bus-message.c
|
|
index 97ab0e3..b9d7f6d 100644
|
|
--- src/libsystemd/sd-bus/bus-message.c
|
|
+++ src/libsystemd/sd-bus/bus-message.c
|
|
@@ -4885,6 +4885,7 @@ int bus_message_parse_fields(sd_bus_message *m) {
|
|
size_t ri;
|
|
int r;
|
|
uint32_t unix_fds = 0;
|
|
+ bool unix_fds_set = false;
|
|
void *offsets = NULL;
|
|
unsigned n_offsets = 0;
|
|
size_t sz = 0;
|
|
@@ -5097,7 +5098,7 @@ int bus_message_parse_fields(sd_bus_message *m) {
|
|
}
|
|
|
|
case BUS_MESSAGE_HEADER_UNIX_FDS:
|
|
- if (unix_fds != 0)
|
|
+ if (unix_fds_set)
|
|
return -EBADMSG;
|
|
|
|
if (!streq(signature, "u"))
|
|
@@ -5107,9 +5108,7 @@ int bus_message_parse_fields(sd_bus_message *m) {
|
|
if (r < 0)
|
|
return -EBADMSG;
|
|
|
|
- if (unix_fds == 0)
|
|
- return -EBADMSG;
|
|
-
|
|
+ unix_fds_set = true;
|
|
break;
|
|
|
|
default:
|
|
--
|
|
1.7.9.2
|
|
|