From patchwork Fri Nov 10 10:49:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Dichtel X-Patchwork-Id: 836671 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netfilter-devel-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yYH5F3V9sz9sNr for ; Fri, 10 Nov 2017 21:56:01 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752711AbdKJK4A (ORCPT ); Fri, 10 Nov 2017 05:56:00 -0500 Received: from host.76.145.23.62.rev.coltfrance.com ([62.23.145.76]:54646 "EHLO proxy.6wind.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752405AbdKJK4A (ORCPT ); Fri, 10 Nov 2017 05:56:00 -0500 X-Greylist: delayed 382 seconds by postgrey-1.27 at vger.kernel.org; Fri, 10 Nov 2017 05:55:59 EST Received: from bretzel.dev.6wind.com (unknown [10.16.0.19]) by proxy.6wind.com (Postfix) with ESMTPS id E3DECFDECA; Fri, 10 Nov 2017 11:42:47 +0100 (CET) Received: from dichtel by bretzel.dev.6wind.com with local (Exim 4.84_2) (envelope-from ) id 1eD6sG-0002pc-0Q; Fri, 10 Nov 2017 11:49:24 +0100 From: Nicolas Dichtel To: pablo@netfilter.org Cc: netfilter-devel@vger.kernel.org, huaibin Wang , Nicolas Dichtel Subject: [PATCH iptables] libxt_sctp: fix array out of range in print_chunk Date: Fri, 10 Nov 2017 11:49:05 +0100 Message-Id: <20171110104905.9205-1-nicolas.dichtel@6wind.com> X-Mailer: git-send-email 2.13.2 Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org From: huaibin Wang 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 Signed-off-by: Nicolas Dichtel --- 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); } }