|
|
9a3fa7 |
From 0bf795555728e54db2593a73f90d7820cf3ef4c6 Mon Sep 17 00:00:00 2001
|
|
|
9a3fa7 |
From: Phil Sutter <psutter@redhat.com>
|
|
|
9a3fa7 |
Date: Fri, 15 Mar 2019 17:50:34 +0100
|
|
|
9a3fa7 |
Subject: [PATCH] libxt_ipvs: Avoid potential buffer overrun
|
|
|
9a3fa7 |
|
|
|
9a3fa7 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1525980
|
|
|
9a3fa7 |
Upstream Status: iptables commit 749d3c2ecd6a9
|
|
|
9a3fa7 |
|
|
|
9a3fa7 |
commit 749d3c2ecd6a9dc21f5a442c44495cb705621dff
|
|
|
9a3fa7 |
Author: Phil Sutter <phil@nwl.cc>
|
|
|
9a3fa7 |
Date: Wed Sep 19 15:16:51 2018 +0200
|
|
|
9a3fa7 |
|
|
|
9a3fa7 |
libxt_ipvs: Avoid potential buffer overrun
|
|
|
9a3fa7 |
|
|
|
9a3fa7 |
Just like with libxt_conntrack, get rid of the temporary buffer. The
|
|
|
9a3fa7 |
comment even states that it was copied from there, so just make them
|
|
|
9a3fa7 |
identical again.
|
|
|
9a3fa7 |
|
|
|
9a3fa7 |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
9a3fa7 |
Signed-off-by: Florian Westphal <fw@strlen.de>
|
|
|
9a3fa7 |
|
|
|
9a3fa7 |
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
|
|
9a3fa7 |
---
|
|
|
9a3fa7 |
extensions/libxt_ipvs.c | 22 ++++++++++++----------
|
|
|
9a3fa7 |
1 file changed, 12 insertions(+), 10 deletions(-)
|
|
|
9a3fa7 |
|
|
|
9a3fa7 |
diff --git a/extensions/libxt_ipvs.c b/extensions/libxt_ipvs.c
|
|
|
9a3fa7 |
index 46727660a027a..a6c57a030d2c6 100644
|
|
|
9a3fa7 |
--- a/extensions/libxt_ipvs.c
|
|
|
9a3fa7 |
+++ b/extensions/libxt_ipvs.c
|
|
|
9a3fa7 |
@@ -126,19 +126,19 @@ static void ipvs_mt_dump_addr(const union nf_inet_addr *addr,
|
|
|
9a3fa7 |
const union nf_inet_addr *mask,
|
|
|
9a3fa7 |
unsigned int family, bool numeric)
|
|
|
9a3fa7 |
{
|
|
|
9a3fa7 |
- char buf[BUFSIZ];
|
|
|
9a3fa7 |
-
|
|
|
9a3fa7 |
if (family == NFPROTO_IPV4) {
|
|
|
9a3fa7 |
if (!numeric && addr->ip == 0) {
|
|
|
9a3fa7 |
printf(" anywhere");
|
|
|
9a3fa7 |
return;
|
|
|
9a3fa7 |
}
|
|
|
9a3fa7 |
if (numeric)
|
|
|
9a3fa7 |
- strcpy(buf, xtables_ipaddr_to_numeric(&addr->in));
|
|
|
9a3fa7 |
+ printf(" %s%s",
|
|
|
9a3fa7 |
+ xtables_ipaddr_to_numeric(&addr->in),
|
|
|
9a3fa7 |
+ xtables_ipmask_to_numeric(&mask->in));
|
|
|
9a3fa7 |
else
|
|
|
9a3fa7 |
- strcpy(buf, xtables_ipaddr_to_anyname(&addr->in));
|
|
|
9a3fa7 |
- strcat(buf, xtables_ipmask_to_numeric(&mask->in));
|
|
|
9a3fa7 |
- printf(" %s", buf);
|
|
|
9a3fa7 |
+ printf(" %s%s",
|
|
|
9a3fa7 |
+ xtables_ipaddr_to_anyname(&addr->in),
|
|
|
9a3fa7 |
+ xtables_ipmask_to_numeric(&mask->in));
|
|
|
9a3fa7 |
} else if (family == NFPROTO_IPV6) {
|
|
|
9a3fa7 |
if (!numeric && addr->ip6[0] == 0 && addr->ip6[1] == 0 &&
|
|
|
9a3fa7 |
addr->ip6[2] == 0 && addr->ip6[3] == 0) {
|
|
|
9a3fa7 |
@@ -146,11 +146,13 @@ static void ipvs_mt_dump_addr(const union nf_inet_addr *addr,
|
|
|
9a3fa7 |
return;
|
|
|
9a3fa7 |
}
|
|
|
9a3fa7 |
if (numeric)
|
|
|
9a3fa7 |
- strcpy(buf, xtables_ip6addr_to_numeric(&addr->in6));
|
|
|
9a3fa7 |
+ printf(" %s%s",
|
|
|
9a3fa7 |
+ xtables_ip6addr_to_numeric(&addr->in6),
|
|
|
9a3fa7 |
+ xtables_ip6mask_to_numeric(&mask->in6));
|
|
|
9a3fa7 |
else
|
|
|
9a3fa7 |
- strcpy(buf, xtables_ip6addr_to_anyname(&addr->in6));
|
|
|
9a3fa7 |
- strcat(buf, xtables_ip6mask_to_numeric(&mask->in6));
|
|
|
9a3fa7 |
- printf(" %s", buf);
|
|
|
9a3fa7 |
+ printf(" %s%s",
|
|
|
9a3fa7 |
+ xtables_ip6addr_to_anyname(&addr->in6),
|
|
|
9a3fa7 |
+ xtables_ip6mask_to_numeric(&mask->in6));
|
|
|
9a3fa7 |
}
|
|
|
9a3fa7 |
}
|
|
|
9a3fa7 |
|
|
|
9a3fa7 |
--
|
|
|
9a3fa7 |
2.21.0
|
|
|
9a3fa7 |
|