All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 7/8] Skip sizechecking if it's zero
@ 2005-11-08  1:45 Pablo Neira
  0 siblings, 0 replies; only message in thread
From: Pablo Neira @ 2005-11-08  1:45 UTC (permalink / raw)
  To: Netfilter Development Mailinglist; +Cc: Harald Welte, Patrick McHardy

[-- Attachment #1: Type: text/plain, Size: 569 bytes --]

Skip sizecheck if the size of the attribute wasn't specified, ie. zero.
The idea is providing a way to sizecheck leaf attributes and ignore the
nest (that has variable size depending on the leaves). This way we can
sizecheck at the beginning of every operation instead of polluting the
code with sizecheckings everywhere. Please, have a look at the next
patch (8/8).

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

-- 
The dawn of the fourth age of Linux firewalling is coming; a time of
great struggle and heroic deeds -- J.Kadlecsik got inspired by J.Morris

[-- Attachment #2: 06-check-bad-size.patch --]
[-- Type: text/plain, Size: 884 bytes --]

Skip sizecheck if the size of the attribute wasn't specified, ie. zero.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

Index: netfilter-2.6.14.git/include/linux/netfilter/nfnetlink.h
===================================================================
--- netfilter-2.6.14.git.orig/include/linux/netfilter/nfnetlink.h	2005-11-06 19:31:06.000000000 +0100
+++ netfilter-2.6.14.git/include/linux/netfilter/nfnetlink.h	2005-11-06 19:31:28.000000000 +0100
@@ -154,11 +154,14 @@ extern void nfattr_parse(struct nfattr *
 
 #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;								\
 })
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-11-08  1:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-08  1:45 [PATCH 7/8] Skip sizechecking if it's zero Pablo Neira

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.