From a4cb3eb0116e9d3fd0dc9a252fb22ab5d404b7e8 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Fri, 25 Oct 2024 15:47:56 +0200 Subject: [PATCH] tun: Use OSMO_STRLCPY_ARRAY tun->devname buffer is already IFNAMSIZ bytes long, so simplify the code. Change-Id: I40b370f4152748d5acf6ee576462e54c9a46a8a3 --- lib/tun.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tun.c b/lib/tun.c index 89fe292..60d9b5e 100644 --- a/lib/tun.c +++ b/lib/tun.c @@ -44,6 +44,7 @@ #include #include +#include #include "tun.h" #include "syserr.h" @@ -107,8 +108,7 @@ static struct tun_t *tun_alloc_common(const char *devname) tun->addrs = 0; tun->tundev.fd = -1; - osmo_strlcpy(tun->devname, devname, IFNAMSIZ); - tun->devname[IFNAMSIZ - 1] = 0; + OSMO_STRLCPY_ARRAY(tun->devname, devname); return tun; }