netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 4/9] netfilter: nf_conntrack_sip: CSeq 0 is a valid CSeq
Date: Wed, 10 Aug 2016 21:16:40 +0200	[thread overview]
Message-ID: <1470856605-7903-5-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1470856605-7903-1-git-send-email-pablo@netfilter.org>

From: Christophe Leroy <christophe.leroy@c-s.fr>

Do not drop packet when CSeq is 0 as 0 is also a valid value for CSeq.

simple_strtoul() will return 0 either when all digits are 0
or if there are no digits at all. Therefore when simple_strtoul()
returns 0 we check if first character is digit 0 or not.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_conntrack_sip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c
index 8d9db9d..7d77217 100644
--- a/net/netfilter/nf_conntrack_sip.c
+++ b/net/netfilter/nf_conntrack_sip.c
@@ -1383,7 +1383,7 @@ static int process_sip_response(struct sk_buff *skb, unsigned int protoff,
 		return NF_DROP;
 	}
 	cseq = simple_strtoul(*dptr + matchoff, NULL, 10);
-	if (!cseq) {
+	if (!cseq && *(*dptr + matchoff) != '0') {
 		nf_ct_helper_log(skb, ct, "cannot get cseq");
 		return NF_DROP;
 	}
@@ -1446,7 +1446,7 @@ static int process_sip_request(struct sk_buff *skb, unsigned int protoff,
 			return NF_DROP;
 		}
 		cseq = simple_strtoul(*dptr + matchoff, NULL, 10);
-		if (!cseq) {
+		if (!cseq && *(*dptr + matchoff) != '0') {
 			nf_ct_helper_log(skb, ct, "cannot get cseq");
 			return NF_DROP;
 		}
-- 
2.1.4


  parent reply	other threads:[~2016-08-10 19:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10 19:16 [PATCH 0/9] Netfilter fixes for net Pablo Neira Ayuso
2016-08-10 19:16 ` [PATCH 1/9] netfilter: nf_ct_h323: do not re-activate already expired timer Pablo Neira Ayuso
2016-08-10 19:16 ` [PATCH 2/9] netfilter: nf_tables: s/MFT_REG32_01/NFT_REG32_01 Pablo Neira Ayuso
2016-08-10 19:16 ` [PATCH 3/9] netfilter: nft_rbtree: ignore inactive matching element with no descendants Pablo Neira Ayuso
2016-08-10 19:16 ` Pablo Neira Ayuso [this message]
2016-08-10 19:16 ` [PATCH 5/9] netfilter: nf_ct_expect: remove the redundant slash when policy name is empty Pablo Neira Ayuso
2016-08-10 19:16 ` [PATCH 6/9] netfilter: nfnetlink_queue: fix memory leak when attach expectation successfully Pablo Neira Ayuso
2016-08-10 19:16 ` [PATCH 7/9] netfilter: nfnetlink_queue: reject verdict request from different portid Pablo Neira Ayuso
2016-08-10 19:16 ` [PATCH 8/9] netfilter: ctnetlink: reject new conntrack request with different l4proto Pablo Neira Ayuso
2016-08-10 19:16 ` [PATCH 9/9] netfilter: nft_exthdr: Add size check on u8 nft_exthdr attributes Pablo Neira Ayuso
  -- strict thread matches above, loose matches on Subject: below --
2016-08-10 18:56 [PATCH 0/9] Netfilter fixes for net Pablo Neira Ayuso
2016-08-10 18:56 ` [PATCH 4/9] netfilter: nf_conntrack_sip: CSeq 0 is a valid CSeq Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1470856605-7903-5-git-send-email-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).