summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-socket.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-03-30 15:19:22 +0100
committerLennart Poettering <lennart@poettering.net>2013-03-30 15:21:55 +0100
commit5384d4b3d76424a466fe54da744dca8711ffa60f (patch)
tree50f59729f8471f447499ed495d75da2cab27c775 /src/libsystemd-bus/bus-socket.c
parent0f4b73c8d379183678d5b99cf235f24c8ebd32f3 (diff)
bus: if we recieve fds but fd passing is off, consider this an error
Diffstat (limited to 'src/libsystemd-bus/bus-socket.c')
-rw-r--r--src/libsystemd-bus/bus-socket.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libsystemd-bus/bus-socket.c b/src/libsystemd-bus/bus-socket.c
index 9512d2e318..de823d582f 100644
--- a/src/libsystemd-bus/bus-socket.c
+++ b/src/libsystemd-bus/bus-socket.c
@@ -542,6 +542,15 @@ int bus_socket_read_message(sd_bus *bus, sd_bus_message **m) {
n = (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int);
+ if (!bus->can_fds) {
+ /* Whut? We received fds but this
+ * isn't actually enabled? Close them,
+ * and fail */
+
+ close_many((int*) CMSG_DATA(cmsg), n);
+ return -EIO;
+ }
+
f = realloc(bus->fds, sizeof(int) + (bus->n_fds + n));
if (!f) {
close_many((int*) CMSG_DATA(cmsg), n);