summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-03-14 21:15:32 +0100
committerLennart Poettering <lennart@poettering.net>2014-03-14 21:17:14 +0100
commit5a4d665ad679a8436f1210ba67d713a8f0b91b96 (patch)
treeaf060598aaf9778ee6b62305244696b3b27aa242 /src/libsystemd/sd-bus
parentbbb6ff0216a7c081a2e63e01b1f121592b0165bb (diff)
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...
Diffstat (limited to 'src/libsystemd/sd-bus')
-rw-r--r--src/libsystemd/sd-bus/bus-message.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
index 97ab0e3bea..b9d7f6dbfd 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/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: