attr: Do not enforce maximum length for NLA_FLAG attributes
Although wasteful, NLA_FLAG with non zero payload cause no harm and should thus not be rejected. Signed-off-by: Thomas Graf <tgraf@suug.ch>
This commit is contained in:
parent
9e6cdbf6fc
commit
60b370de8c
1 changed files with 1 additions and 3 deletions
|
@ -182,6 +182,7 @@ static uint16_t nla_attr_minlen[NLA_TYPE_MAX+1] = {
|
|||
[NLA_U32] = sizeof(uint32_t),
|
||||
[NLA_U64] = sizeof(uint64_t),
|
||||
[NLA_STRING] = 1,
|
||||
[NLA_FLAG] = 0,
|
||||
};
|
||||
|
||||
static int validate_nla(struct nlattr *nla, int maxtype,
|
||||
|
@ -204,9 +205,6 @@ static int validate_nla(struct nlattr *nla, int maxtype,
|
|||
else if (pt->type != NLA_UNSPEC)
|
||||
minlen = nla_attr_minlen[pt->type];
|
||||
|
||||
if (pt->type == NLA_FLAG && nla_len(nla) > 0)
|
||||
return -NLE_RANGE;
|
||||
|
||||
if (nla_len(nla) < minlen)
|
||||
return -NLE_RANGE;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue