]> granicus.if.org Git - libnl/commitdiff
attr: Do not enforce maximum length for NLA_FLAG attributes
authorThomas Graf <tgraf@suug.ch>
Wed, 13 Mar 2013 16:01:54 +0000 (17:01 +0100)
committerThomas Graf <tgraf@suug.ch>
Thu, 14 Mar 2013 11:46:04 +0000 (12:46 +0100)
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>
lib/attr.c

index 2c03fa15019c24cbbbfaf6e5a564360a48542234..90070dfe239c6551eb730c2e1075b54ea0a8c794 100644 (file)
@@ -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;