summaryrefslogtreecommitdiffhomepage
path: root/src/config.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-05-30 23:04:36 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-05-31 05:35:34 +0200
commit03fffb2eff8174ceb94e5faef4c86a0de8a9027e (patch)
tree449200fef058b201423e9977377f2f7b476f97e3 /src/config.c
parentd5d5dcfa4bfc343e9d74d9c5c00ba79d8c57991d (diff)
config: it's faster to memcpy than strncpy
IFNAMSIZ is 16, so this is two instructions on 64-bit. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/config.c b/src/config.c
index f3357b5..907c6b3 100644
--- a/src/config.c
+++ b/src/config.c
@@ -317,8 +317,7 @@ int config_get_device(struct wireguard_device *wg, void __user *user_device)
out_device.version_magic = WG_API_VERSION_MAGIC;
out_device.port = wg->incoming_port;
out_device.fwmark = wg->fwmark;
- strncpy(out_device.interface, dev->name, IFNAMSIZ - 1);
- out_device.interface[IFNAMSIZ - 1] = 0;
+ memcpy(out_device.interface, dev->name, IFNAMSIZ);
down_read(&wg->static_identity.lock);
if (wg->static_identity.has_identity) {