Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1455737 > unrolled thread

[PATCH v2] netfilter: nf_conntrack_sip: CSeq 0 is a valid CSeq

Started byChristophe Leroy <christophe.leroy@c-s.fr>
First post2016-08-03 12:50 +0200
Last post2016-08-08 13:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] netfilter: nf_conntrack_sip: CSeq 0 is a valid CSeq Christophe Leroy <christophe.leroy@c-s.fr> - 2016-08-03 12:50 +0200
    Re: [PATCH v2] netfilter: nf_conntrack_sip: CSeq 0 is a valid CSeq Pablo Neira Ayuso <pablo@netfilter.org> - 2016-08-08 13:20 +0200

#1455737 — [PATCH v2] netfilter: nf_conntrack_sip: CSeq 0 is a valid CSeq

FromChristophe Leroy <christophe.leroy@c-s.fr>
Date2016-08-03 12:50 +0200
Subject[PATCH v2] netfilter: nf_conntrack_sip: CSeq 0 is a valid CSeq
Message-ID<s21Ul-1q9-5@gated-at.bofh.it>
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>
---
 v2: not using kstrtouint() anymore, as it required to use a temp buffer

 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.0

[toc] | [next] | [standalone]


#1457727

FromPablo Neira Ayuso <pablo@netfilter.org>
Date2016-08-08 13:20 +0200
Message-ID<s3QL8-Ev-43@gated-at.bofh.it>
In reply to#1455737
On Wed, Aug 03, 2016 at 12:41:40PM +0200, Christophe Leroy wrote:
> 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.

Applied, thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web