mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 22:30:11 +01:00
platform/netlink: assert for valid policy for string attribute in validate_nla
The policy for strings must indicate a minlen of at least 1. Everything else is a bug, because the policy contains invalid data -- and is determined at compile-time.
This commit is contained in:
parent
82e31b2816
commit
f7df8fda1a
1 changed files with 5 additions and 1 deletions
|
|
@ -586,7 +586,11 @@ validate_nla (const struct nlattr *nla, int maxtype,
|
|||
return -NME_UNSPEC;
|
||||
|
||||
if (pt->type == NLA_STRING) {
|
||||
const char *data = nla_data (nla);
|
||||
const char *data;
|
||||
|
||||
nm_assert (minlen > 0);
|
||||
|
||||
data = nla_data (nla);
|
||||
if (data[nla_len (nla) - 1] != '\0')
|
||||
return -NME_UNSPEC;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue