1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 18:27:04 +03:00

networkd: use valid bus paths

Object path components must start with [A-Za-z_] (AFAIK).
Also the value of 'p' is undefined if asprintf fails.
Compare to user_bus_path() in src/login/logind-user-dbus.c:281.
This commit is contained in:
Mantas Mikulėnas 2015-02-06 22:35:14 +02:00 committed by Tom Gundersen
parent b8719ebb57
commit 02f500532e

View File

@ -43,7 +43,8 @@ static char *link_bus_path(Link *link) {
assert(link); assert(link);
assert(link->ifindex > 0); assert(link->ifindex > 0);
asprintf(&p, "/org/freedesktop/network1/link/%d", link->ifindex); if (asprintf(&p, "/org/freedesktop/network1/link/_%d", link->ifindex) < 0)
return NULL;
return p; return p;
} }
@ -89,7 +90,7 @@ int link_object_find(sd_bus *bus, const char *path, const char *interface, void
assert(m); assert(m);
assert(found); assert(found);
if (sscanf(path, "/org/freedesktop/network1/link/%d", &ifindex) != 1) if (sscanf(path, "/org/freedesktop/network1/link/_%d", &ifindex) != 1)
return 0; return 0;
r = link_get(m, ifindex, &link); r = link_get(m, ifindex, &link);