1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

sd-bus: correct size calculation in DBus fd receive

The size of the allocated array for received file descriptors was
incorrectly calculated. This did not matter when a single file
descriptor was received, but for more descriptors the allocation was
insufficient.
This commit is contained in:
Michal Schmidt 2015-09-16 22:55:02 +02:00
parent 5ee50f525f
commit a0f5ab70f3

View File

@ -985,7 +985,7 @@ int bus_socket_read_message(sd_bus *bus) {
return -EIO;
}
f = realloc(bus->fds, sizeof(int) + (bus->n_fds + n));
f = realloc(bus->fds, sizeof(int) * (bus->n_fds + n));
if (!f) {
close_many((int*) CMSG_DATA(cmsg), n);
return -ENOMEM;