lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 4 Jul 2016 13:48:10 +0800
From:	Liping Zhang <zlpnobody@...il.com>
To:	Christophe Leroy <christophe.leroy@....fr>
Cc:	Pablo Neira Ayuso <pablo@...filter.org>,
	Patrick McHardy <kaber@...sh.net>,
	Jozsef Kadlecsik <kadlec@...ckhole.kfki.hu>,
	"David S. Miller" <davem@...emloft.net>,
	netfilter-devel@...r.kernel.org, coreteam@...filter.org,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] netfilter: nf_conntrack_sip: CSeq 0 is a valid CSeq

2016-07-01 17:48 GMT+08:00 Christophe Leroy <christophe.leroy@....fr>:
> Do not drop packet when CSeq is 0 as 0 is also a valid value for CSeq.
>
> --- a/net/netfilter/nf_conntrack_sip.c
> +++ b/net/netfilter/nf_conntrack_sip.c
> @@ -1368,6 +1368,7 @@ static int process_sip_response(struct sk_buff *skb, unsigned int protoff,
>         struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
>         unsigned int matchoff, matchlen, matchend;
>         unsigned int code, cseq, i;
> +       char buf[21];
>
>         if (*datalen < strlen("SIP/2.0 200"))
>                 return NF_ACCEPT;
> @@ -1382,8 +1383,13 @@ static int process_sip_response(struct sk_buff *skb, unsigned int protoff,
>                 nf_ct_helper_log(skb, ct, "cannot parse cseq");
>                 return NF_DROP;
>         }
> -       cseq = simple_strtoul(*dptr + matchoff, NULL, 10);
> -       if (!cseq) {

I think there is no need to convert simple_strtoul to kstrtouint, add
a further check seems better?
Like this:
 -       if (!cseq) {
+       if (!cseq && *(*dptr + matchoff) != '0') {

> +       if (matchlen > sizeof(buf) - 1) {
> +               nf_ct_helper_log(skb, ct, "cannot parse cseq (too big)");
> +               return NF_DROP;
> +       }
> +       memcpy(buf, *dptr + matchoff, matchlen);
> +       buf[matchlen] = 0;
> +       if (kstrtouint(buf, 10, &cseq)) {
>                 nf_ct_helper_log(skb, ct, "cannot get cseq");
>                 return NF_DROP;
>         }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ