mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-01 03:40:11 +01:00
platform/netlink: use switch for type check in validate_nla()
This commit is contained in:
parent
68a5d1cfe5
commit
f7635c9ffe
1 changed files with 6 additions and 3 deletions
|
|
@ -622,14 +622,17 @@ validate_nla(const struct nlattr *nla, int maxtype, const struct nla_policy *pol
|
|||
if (pt->maxlen && len > pt->maxlen)
|
||||
return -NME_UNSPEC;
|
||||
|
||||
if (pt->type == NLA_STRING) {
|
||||
const char *data;
|
||||
switch (pt->type) {
|
||||
case NLA_STRING:
|
||||
{
|
||||
const char *data = nla_data(nla);
|
||||
|
||||
nm_assert(minlen > 0);
|
||||
|
||||
data = nla_data(nla);
|
||||
if (data[len - 1u] != '\0')
|
||||
return -NME_UNSPEC;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue