laurenceman / rpms / iptables

Forked from rpms/iptables 5 years ago
Clone

Blame SOURCES/libxt_sctp-fix-array-out-of-range-in-print_chunk.patch

9a3fa7
From db1fcba4cade70fd86e615246bb03acd94cc4cd9 Mon Sep 17 00:00:00 2001
9a3fa7
From: Phil Sutter <psutter@redhat.com>
9a3fa7
Date: Fri, 15 Mar 2019 17:50:10 +0100
9a3fa7
Subject: [PATCH] libxt_sctp: fix array out of range in print_chunk
9a3fa7
9a3fa7
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1525980
9a3fa7
Upstream Status: iptables commit 71de414c21f7f
9a3fa7
Conflicts: Dropped changes to non-existing libxt_sctp.t.
9a3fa7
9a3fa7
commit 71de414c21f7f31270e5d62e782e52257e5c3d06
9a3fa7
Author: huaibin Wang <huaibin.wang@6wind.com>
9a3fa7
Date:   Mon Nov 13 14:27:54 2017 +0100
9a3fa7
9a3fa7
    libxt_sctp: fix array out of range in print_chunk
9a3fa7
9a3fa7
    For chunk type ASCONF, ASCONF_ACK and FORWARD_TSN, sctp_chunk_names[].chunk_type
9a3fa7
    is not equal to the corresponding index in sctp_chunk_names[]. Using this field
9a3fa7
    leads to a segmentation fault (index out of range).
9a3fa7
9a3fa7
    Example
9a3fa7
    $ iptables -A INPUT -p sctp --chunk-type all ASCONF,ASCONF_ACK,FORWARD_TSN -j ACCEPT
9a3fa7
    $ iptables -L
9a3fa7
    Chain INPUT (policy ACCEPT)
9a3fa7
    target     prot opt source               destination
9a3fa7
    Segmentation fault
9a3fa7
9a3fa7
    Signed-off-by: huaibin Wang <huaibin.wang@6wind.com>
9a3fa7
    Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
9a3fa7
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
9a3fa7
9a3fa7
Signed-off-by: Phil Sutter <psutter@redhat.com>
9a3fa7
---
9a3fa7
 extensions/libxt_sctp.c | 2 +-
9a3fa7
 1 file changed, 1 insertion(+), 1 deletion(-)
9a3fa7
9a3fa7
diff --git a/extensions/libxt_sctp.c b/extensions/libxt_sctp.c
9a3fa7
index 56a4cdf229390..cfd4c12330479 100644
9a3fa7
--- a/extensions/libxt_sctp.c
9a3fa7
+++ b/extensions/libxt_sctp.c
9a3fa7
@@ -370,7 +370,7 @@ print_chunk(uint32_t chunknum, int numeric)
9a3fa7
 
9a3fa7
 		for (i = 0; i < ARRAY_SIZE(sctp_chunk_names); ++i)
9a3fa7
 			if (sctp_chunk_names[i].chunk_type == chunknum)
9a3fa7
-				printf("%s", sctp_chunk_names[chunknum].name);
9a3fa7
+				printf("%s", sctp_chunk_names[i].name);
9a3fa7
 	}
9a3fa7
 }
9a3fa7
 
9a3fa7
-- 
9a3fa7
2.21.0
9a3fa7