All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/6] Remove duplicate checkings in nfnetlink_check_attributes
@ 2007-02-15  3:23 Pablo Neira Ayuso
  0 siblings, 0 replies; only message in thread
From: Pablo Neira Ayuso @ 2007-02-15  3:23 UTC (permalink / raw)
  To: Netfilter Development Mailinglist; +Cc: Patrick McHardy

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

nfnetlink_check_attributes duplicates message size and callback id
checkings. nfnetlink_find_client and nfnetlink_rcv_msg already do such
checkings.

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: 04.patch --]
[-- Type: text/plain, Size: 1124 bytes --]

[PATCH] Remove duplicate checkings in nfnetlink_check_attributes

nfnetlink_check_attributes duplicates message size and callback id checkings. 
nfnetlink_find_client and nfnetlink_rcv_msg already do such checkings.

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

Index: net-2.6.git/net/netfilter/nfnetlink.c
===================================================================
--- net-2.6.git.orig/net/netfilter/nfnetlink.c	2006-12-26 04:45:09.000000000 +0100
+++ net-2.6.git/net/netfilter/nfnetlink.c	2006-12-26 04:49:28.000000000 +0100
@@ -127,17 +127,10 @@ static int
 nfnetlink_check_attributes(struct nfnetlink_subsystem *subsys,
 			   struct nlmsghdr *nlh, struct nfattr *cda[])
 {
-	int min_len;
+	int min_len = NLMSG_SPACE(sizeof(struct nfgenmsg));
 	u_int16_t attr_count;
 	u_int8_t cb_id = NFNL_MSG_TYPE(nlh->nlmsg_type);
 
-	if (unlikely(cb_id >= subsys->cb_count))
-		return -EINVAL;
-
-	min_len = NLMSG_SPACE(sizeof(struct nfgenmsg));
-	if (unlikely(nlh->nlmsg_len < min_len))
-		return -EINVAL;
-
 	attr_count = subsys->cb[cb_id].attr_count;
 	memset(cda, 0, sizeof(struct nfattr *) * attr_count);
 

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

only message in thread, other threads:[~2007-02-15  3:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-15  3:23 [PATCH 3/6] Remove duplicate checkings in nfnetlink_check_attributes Pablo Neira Ayuso

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.