All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/8] Add sanity checkings for ICMP
@ 2005-12-05 11:20 Pablo Neira Ayuso
  2005-12-09  2:40 ` Yasuyuki KOZAKAI
       [not found] ` <200512090240.jB92egAp002675@toshiba.co.jp>
  0 siblings, 2 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2005-12-05 11:20 UTC (permalink / raw)
  To: Netfilter Development Mailinglist; +Cc: Patrick McHardy

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


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

Add proper checkings to avoid possible malformed ICMP conntracks. And return 
to userspace -EINVAL in case of error.

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

Index: netfilter-2.6.14.git/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
===================================================================
--- netfilter-2.6.14.git.orig/net/ipv4/netfilter/ip_conntrack_proto_icmp.c	2005-12-04 03:35:50.000000000 +0100
+++ netfilter-2.6.14.git/net/ipv4/netfilter/ip_conntrack_proto_icmp.c	2005-12-04 03:37:24.000000000 +0100
@@ -288,10 +288,14 @@ nfattr_failure:
 static int icmp_nfattr_to_tuple(struct nfattr *tb[],
 				struct ip_conntrack_tuple *tuple)
 {
+	if (tuple->dst.u.icmp.type >= sizeof(valid_new)
+	    || !valid_new[tuple->dst.u.icmp.type])
+		return -EINVAL;
+
 	if (!tb[CTA_PROTO_ICMP_TYPE-1]
 	    || !tb[CTA_PROTO_ICMP_CODE-1]
 	    || !tb[CTA_PROTO_ICMP_ID-1])
-		return -1;
+		return -EINVAL;
 
 	tuple->dst.u.icmp.type = 
 			*(u_int8_t *)NFA_DATA(tb[CTA_PROTO_ICMP_TYPE-1]);

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-12-15  0:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-05 11:20 [PATCH 2/8] Add sanity checkings for ICMP Pablo Neira Ayuso
2005-12-09  2:40 ` Yasuyuki KOZAKAI
     [not found] ` <200512090240.jB92egAp002675@toshiba.co.jp>
2005-12-15  0:49   ` 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.