1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-12 13:18:14 +03:00

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...
This commit is contained in:
Lennart Poettering 2014-03-14 21:15:32 +01:00
parent bbb6ff0216
commit 5a4d665ad6
Notes: Lennart Poettering 2014-03-14 21:19:32 +01:00
Backport: bugfix

View File

@ -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: