summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Wagner <wagi@monom.org>2021-04-05 17:25:27 +0200
committerNishant Chaprana <n.chaprana@samsung.com>2021-07-13 11:51:09 +0530
commitd4281c2cb7c8b1ad02669a03369872230394b509 (patch)
treee47a0811c4828651589212e51e445b649fd15ab4
parentd2986e451a7f747bf042a613faf58e51e9dc24a3 (diff)
downloadconnman-d4281c2cb7c8b1ad02669a03369872230394b509.tar.gz
connman-d4281c2cb7c8b1ad02669a03369872230394b509.tar.bz2
connman-d4281c2cb7c8b1ad02669a03369872230394b509.zip
wireguard: Copy interfance names obeying lengths rules
gcc points out the destination buffer has the same size the specified bound for the string. warning: ‘__builtin_strncpy’ specified bound 16 equals destination size [-Wstringop-truncation] Let's make sure we do not overflow the buffer (should not happen as the names are provide by the kernel and hence should fit). Change-Id: I1e8818f0820ffb32083e14cb88e4919fd8b12798 Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
-rw-r--r--vpn/plugins/wireguard.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/vpn/plugins/wireguard.c b/vpn/plugins/wireguard.c
index ec57c93d..1da0ffb3 100644
--- a/vpn/plugins/wireguard.c
+++ b/vpn/plugins/wireguard.c
@@ -407,7 +407,7 @@ static int wg_connect(struct vpn_provider *provider,
err = -ENOENT;
goto done;
}
- stpncpy(info->device.name, ifname, sizeof(info->device.name));
+ stpncpy(info->device.name, ifname, sizeof(info->device.name) - 1);
g_free(ifname);
err = wg_add_device(info->device.name);