sd-bus: validate the message type (#7520)

Now that sd_bus_message_new() is public API, we should insist on valid
message types.
This commit is contained in:
Lennart Poettering 2017-12-01 11:59:42 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent a081b9cea0
commit 41f23fe856

View file

@ -584,6 +584,7 @@ _public_ int sd_bus_message_new(
assert_return(bus, -ENOTCONN);
assert_return(bus->state != BUS_UNSET, -ENOTCONN);
assert_return(m, -EINVAL);
assert_return(type < _SD_BUS_MESSAGE_TYPE_MAX, -EINVAL);
t = malloc0(ALIGN(sizeof(sd_bus_message)) + sizeof(struct bus_header));
if (!t)