mirror of
https://github.com/systemd/systemd.git
synced 2025-02-04 21:47:31 +03:00
bus: validate the hello response properly
This commit is contained in:
parent
813a4f9375
commit
dafb75912a
@ -104,16 +104,19 @@ static int hello_callback(sd_bus *bus, int error, sd_bus_message *reply, void *u
|
||||
|
||||
assert(reply);
|
||||
|
||||
bus->state = BUS_RUNNING;
|
||||
|
||||
r = sd_bus_message_read(reply, "s", &s);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (!service_name_is_valid(s) || s[0] != ':')
|
||||
return -EBADMSG;
|
||||
|
||||
bus->unique_name = strdup(s);
|
||||
if (!bus->unique_name)
|
||||
return -ENOMEM;
|
||||
|
||||
bus->state = BUS_RUNNING;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user