From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org,
huaibin Wang <huaibin.wang@6wind.com>,
Nicolas Dichtel <nicolas.dichtel@6wind.com>
Subject: [PATCH iptables] libxt_sctp: fix array out of range in print_chunk
Date: Fri, 10 Nov 2017 11:49:05 +0100 [thread overview]
Message-ID: <20171110104905.9205-1-nicolas.dichtel@6wind.com> (raw)
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);
}
}
--
2.13.2
next reply other threads:[~2017-11-10 10:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-10 10:49 Nicolas Dichtel [this message]
2017-11-13 12:38 ` [PATCH iptables] libxt_sctp: fix array out of range in print_chunk Pablo Neira Ayuso
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=20171110104905.9205-1-nicolas.dichtel@6wind.com \
--to=nicolas.dichtel@6wind.com \
--cc=huaibin.wang@6wind.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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).