netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: netfilter-devel@vger.kernel.org, huaibin Wang <huaibin.wang@6wind.com>
Subject: Re: [PATCH iptables] libxt_sctp: fix array out of range in print_chunk
Date: Mon, 13 Nov 2017 13:38:54 +0100	[thread overview]
Message-ID: <20171113123854.GA7570@salvia> (raw)
In-Reply-To: <20171110104905.9205-1-nicolas.dichtel@6wind.com>

Hi Nicolas,

On Fri, Nov 10, 2017 at 11:49:05AM +0100, Nicolas Dichtel wrote:
> From: huaibin Wang <huaibin.wang@6wind.com>
> 
> For chunk type ASCONF, ASCONF_ACK and FORWARD_TSN, sctp_chunk_names[].chunk_type
> is not equal to the corresponding index in sctp_chunk_names[]. Using this field
> leads to a segmentation fault (index out of range).
> 
> Example
> $ iptables -A INPUT -p sctp --chunk-type all ASCONF,ASCONF_ACK,FORWARD_TSN -j ACCEPT
> $ iptables -L
> Chain INPUT (policy ACCEPT)
> target     prot opt source               destination
> Segmentation fault
> 
> Signed-off-by: huaibin Wang <huaibin.wang@6wind.com>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
>  extensions/libxt_sctp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/extensions/libxt_sctp.c b/extensions/libxt_sctp.c
> index df1936be8b83..140de2653b1e 100644
> --- a/extensions/libxt_sctp.c
> +++ b/extensions/libxt_sctp.c
> @@ -370,7 +370,7 @@ print_chunk(uint32_t chunknum, int numeric)
>  
>  		for (i = 0; i < ARRAY_SIZE(sctp_chunk_names); ++i)
>  			if (sctp_chunk_names[i].chunk_type == chunknum)
> -				printf("%s", sctp_chunk_names[chunknum].name);
> +				printf("%s", sctp_chunk_names[i].name);

Can we get a test for iptables/extensions/libxt_sctp.t ?

Thanks!

  reply	other threads:[~2017-11-13 12:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-10 10:49 [PATCH iptables] libxt_sctp: fix array out of range in print_chunk Nicolas Dichtel
2017-11-13 12:38 ` Pablo Neira Ayuso [this message]
2017-11-13 13:27   ` [PATCH iptables v2] " Nicolas Dichtel
2017-11-13 13:29     ` 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=20171113123854.GA7570@salvia \
    --to=pablo@netfilter.org \
    --cc=huaibin.wang@6wind.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    /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).