From: Thomas Graf Date: Wed, 13 Mar 2013 16:01:54 +0000 (+0100) Subject: attr: Do not enforce maximum length for NLA_FLAG attributes X-Git-Tag: libnl3_2_22rc1~33 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=60b370de8ca2c66a9259182ae2fc4588ed8777d9;p=libnl 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 --- diff --git a/lib/attr.c b/lib/attr.c index 2c03fa1..90070df 100644 --- a/lib/attr.c +++ b/lib/attr.c @@ -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;