summaryrefslogtreecommitdiff
path: root/src/platform
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-10-23 13:55:54 +0200
committerThomas Haller <thaller@redhat.com>2017-10-24 16:04:46 +0200
commit6e01238a407ac546bf20fd23998b28cde672aeba (patch)
treef16f64f0640b1c912d2a1bea930543a16a85eb8a /src/platform
parentb27a10bde8f0e28b16cc52e2c2f7de39d44cf0e6 (diff)
downloadNetworkManager-6e01238a407ac546bf20fd23998b28cde672aeba.tar.gz
core: don't use static buffer for nm_utils_ip4_property_path()
and nm_utils_ip6_property_path(). The API with static buffers looks a bit nicer. But I think they are dangerous, because we tend to pass the buffer down several layers of the stack, and it's not immediately clear, that we don't overwrite the static buffer again (which we probably did not, but it's hard to verify that there is no bug there).
Diffstat (limited to 'src/platform')
-rw-r--r--src/platform/nm-platform.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 90ea2fc720..e1625d16f4 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -414,6 +414,7 @@ nm_platform_sysctl_set_ip6_hop_limit_safe (NMPlatform *self, const char *iface,
{
const char *path;
gint64 cur;
+ char buf[NM_UTILS_IP_PROPERTY_PATH_BUFSIZE];
_CHECK_SELF (self, klass, FALSE);
@@ -425,7 +426,7 @@ nm_platform_sysctl_set_ip6_hop_limit_safe (NMPlatform *self, const char *iface,
if (value < 10)
return FALSE;
- path = nm_utils_ip6_property_path (iface, "hop_limit");
+ path = nm_utils_ip6_property_path (buf, iface, "hop_limit");
cur = nm_platform_sysctl_get_int_checked (self, NMP_SYSCTL_PATHID_ABSOLUTE (path), 10, 1, G_MAXINT32, -1);
/* only allow increasing the hop-limit to avoid DOS by an attacker