9bd85ec1398c66a1411333fb10d2ca3f7637881d
[openwrt/openwrt.git] / package / network / utils / iptables / patches / 001-extensions_format-security_fixes_in_libip.patch
1 From 907e429d7548157016cd51aba4adc5d0c7d9f816 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Adam=20Go=C5=82=C4=99biowski?= <adamg@pld-linux.org>
3 Date: Wed, 14 Nov 2018 07:35:28 +0100
4 Subject: extensions: format-security fixes in libip[6]t_icmp
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 commit 61d6c3834de3 ("xtables: add 'printf' attribute to xlate_add")
10 introduced support for gcc feature to check format string against passed
11 argument. This commit adds missing bits to extenstions's libipt_icmp.c
12 and libip6t_icmp6.c that were causing build to fail.
13
14 Fixes: 61d6c3834de3 ("xtables: add 'printf' attribute to xlate_add")
15 Signed-off-by: Adam Gołębiowski <adamg@pld-linux.org>
16 Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
17 ---
18 extensions/libip6t_icmp6.c | 4 ++--
19 extensions/libipt_icmp.c | 2 +-
20 2 files changed, 3 insertions(+), 3 deletions(-)
21
22 --- a/extensions/libip6t_icmp6.c
23 +++ b/extensions/libip6t_icmp6.c
24 @@ -230,7 +230,7 @@ static unsigned int type_xlate_print(str
25 type_name = icmp6_type_xlate(icmptype);
26
27 if (type_name) {
28 - xt_xlate_add(xl, type_name);
29 + xt_xlate_add(xl, "%s", type_name);
30 } else {
31 for (i = 0; i < ARRAY_SIZE(icmpv6_codes); ++i)
32 if (icmpv6_codes[i].type == icmptype &&
33 @@ -239,7 +239,7 @@ static unsigned int type_xlate_print(str
34 break;
35
36 if (i != ARRAY_SIZE(icmpv6_codes))
37 - xt_xlate_add(xl, icmpv6_codes[i].name);
38 + xt_xlate_add(xl, "%s", icmpv6_codes[i].name);
39 else
40 return 0;
41 }
42 --- a/extensions/libipt_icmp.c
43 +++ b/extensions/libipt_icmp.c
44 @@ -236,7 +236,7 @@ static unsigned int type_xlate_print(str
45 if (icmp_codes[i].type == icmptype &&
46 icmp_codes[i].code_min == code_min &&
47 icmp_codes[i].code_max == code_max) {
48 - xt_xlate_add(xl, icmp_codes[i].name);
49 + xt_xlate_add(xl, "%s", icmp_codes[i].name);
50 return 1;
51 }
52 }