Add proper checkings to avoid possible malformed ICMP conntracks. And return to userspace -EINVAL in case of error. Signed-off-by: Pablo Neira Ayuso 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]);