sd-netlink: fix invalid assertion
It is natural that n_attiributes is less than type. But in that case, the message does not contain any message about the type. So, we should not abort execution with assertion, but just return -ENODATA.
This commit is contained in:
parent
69cebea78a
commit
48fb0d1301
|
@ -577,7 +577,9 @@ static int netlink_message_read_internal(sd_netlink_message *m, unsigned short t
|
|||
|
||||
assert(m->n_containers < RTNL_CONTAINER_DEPTH);
|
||||
assert(m->containers[m->n_containers].attributes);
|
||||
assert(type < m->containers[m->n_containers].n_attributes);
|
||||
|
||||
if (type >= m->containers[m->n_containers].n_attributes)
|
||||
return -ENODATA;
|
||||
|
||||
attribute = &m->containers[m->n_containers].attributes[type];
|
||||
|
||||
|
|
Loading…
Reference in a new issue