* [PATCH 3/7] Remove duplicate checkings in nfnetlink_check_attributes
@ 2007-02-12 22:46 Pablo Neira Ayuso
2007-02-13 10:56 ` Patrick McHardy
0 siblings, 1 reply; 2+ messages in thread
From: Pablo Neira Ayuso @ 2007-02-12 22:46 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] 2+ messages in thread
* Re: [PATCH 3/7] Remove duplicate checkings in nfnetlink_check_attributes
2007-02-12 22:46 [PATCH 3/7] Remove duplicate checkings in nfnetlink_check_attributes Pablo Neira Ayuso
@ 2007-02-13 10:56 ` Patrick McHardy
0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2007-02-13 10:56 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: Netfilter Development Mailinglist
Pablo Neira Ayuso wrote:
> nfnetlink_check_attributes duplicates message size and callback id
> checkings. nfnetlink_find_client and nfnetlink_rcv_msg already do such
> checkings.
Looks good.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-02-13 10:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-12 22:46 [PATCH 3/7] Remove duplicate checkings in nfnetlink_check_attributes Pablo Neira Ayuso
2007-02-13 10:56 ` Patrick McHardy
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.