]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-bus: validate the message type (#7520)
authorLennart Poettering <lennart@poettering.net>
Fri, 1 Dec 2017 10:59:42 +0000 (11:59 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 1 Dec 2017 10:59:42 +0000 (11:59 +0100)
Now that sd_bus_message_new() is public API, we should insist on valid
message types.

src/libsystemd/sd-bus/bus-message.c

index 237392928522b07258560b4d13128e8809516137..9d4ac8ee0fd0fd99cb7eea564915d06c43747fc0 100644 (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)