mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-31 09:50:33 +01:00
libnm: guard against empty attribute names for NMLldpNeighbor
The libnm API NMLldpNeighbor does not accept "" as an attribute name. And it does not need to, because a reasonable NetworkManager should never expose such names. However, we should not trust NetworkManager to be reasonable. Check that the attribute name is not empty.
This commit is contained in:
parent
84d64217f8
commit
cba3113607
1 changed files with 6 additions and 1 deletions
|
|
@ -247,8 +247,13 @@ _notify_update_prop_lldp_neighbors(NMClient * client,
|
|||
/* Note that there is no public API to mutate a NMLldpNeighbor instance.
|
||||
* This is the only place where we actually mutate it. */
|
||||
neigh = nm_lldp_neighbor_new();
|
||||
while (g_variant_iter_next(attrs_iter, "{&sv}", &attr_name, &attr_variant))
|
||||
while (g_variant_iter_next(attrs_iter, "{&sv}", &attr_name, &attr_variant)) {
|
||||
if (attr_name[0] == '\0') {
|
||||
g_variant_unref(attr_variant);
|
||||
continue;
|
||||
}
|
||||
g_hash_table_insert(neigh->attrs, g_strdup(attr_name), attr_variant);
|
||||
}
|
||||
|
||||
g_ptr_array_add(new, neigh);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue