[NETFILTER] nfnetlink: skip size check if size not specified (== 0)
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 14 Nov 2005 23:21:41 +0000 (15:21 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 14 Nov 2005 23:21:41 +0000 (15:21 -0800)
Skip sizecheck if the size of the attribute wasn't specified, ie. zero.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netfilter/nfnetlink.h

index 72975fa8795d21c1c03a247ab4f9fc9aa5a91815..8be2f840a557b64c04422718a9700bc0f998fc4a 100644 (file)
@@ -154,11 +154,14 @@ extern void nfattr_parse(struct nfattr *tb[], int maxattr,
 
 #define nfattr_bad_size(tb, max, cta_min)                              \
 ({     int __i, __res = 0;                                             \
-       for (__i=0; __i<max; __i++)                                     \
+       for (__i=0; __i<max; __i++) {                                   \
+               if (!cta_min[__i])                                      \
+                       continue;                                       \
                if (tb[__i] && NFA_PAYLOAD(tb[__i]) < cta_min[__i]){    \
                        __res = 1;                                      \
                        break;                                          \
                }                                                       \
+       }                                                               \
        __res;                                                          \
 })