mirror of
https://github.com/systemd/systemd.git
synced 2025-01-02 06:34:07 +08:00
bus: use memcpy() rather than unbounded strcpy()
This commit is contained in:
parent
b67f541f13
commit
dff91e8b7f
@ -803,7 +803,7 @@ static int add_name_change_match(sd_bus *bus,
|
||||
item->name_change.new.id = new_owner_id;
|
||||
|
||||
if (name)
|
||||
strcpy(item->name_change.name, name);
|
||||
memcpy(item->name_change.name, name, l);
|
||||
|
||||
/* If the old name is unset or empty, then
|
||||
* this can match against added names */
|
||||
@ -854,7 +854,9 @@ static int add_name_change_match(sd_bus *bus,
|
||||
m->cookie = cookie;
|
||||
|
||||
item = m->items;
|
||||
item->size = offsetof(struct kdbus_item, id_change) + sizeof(struct kdbus_notify_id_change);
|
||||
item->size =
|
||||
offsetof(struct kdbus_item, id_change) +
|
||||
sizeof(struct kdbus_notify_id_change);
|
||||
item->id_change.id = name_id;
|
||||
|
||||
/* If the old name is unset or empty, then this can
|
||||
|
Loading…
Reference in New Issue
Block a user