netfilter: nf_conntrack_sip: CSeq 0 is a valid CSeq
Subsystems (3)
PATCH v2 1/1 netfilter: nf_conntrack_sip: CSeq 0 is a valid CSeq
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 <[email protected]>
---
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(-)
net/netfilter/nf_conntrack_sip.c +2 -2
@@ -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 ; }
Signature · 1 line
2.1.0
Quoted 5 lines · Christophe Leroy
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 whensimple_strtoul()returns 0 we check if first character is digit 0 or not.
Applied, thanks.