From 60b370de8ca2c66a9259182ae2fc4588ed8777d9 Mon Sep 17 00:00:00 2001 From: Thomas Graf Date: Wed, 13 Mar 2013 17:01:54 +0100 Subject: [PATCH] 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 --- lib/attr.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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;