summaryrefslogtreecommitdiffstats
path: root/nhrpd
diff options
context:
space:
mode:
authorReuben Dowle <reuben.dowle@4rf.com>2021-03-04 02:03:07 +0100
committerReuben Dowle <reuben.dowle@4rf.com>2021-04-05 23:23:42 +0200
commitca317495b8aa18bfacf8b9ac83479cf14d8651db (patch)
treeb2d5d17b185f238fefa0edb0495cebe9f3a04dfc /nhrpd
parentnhrpd: Fix style violation issues (diff)
downloadfrr-ca317495b8aa18bfacf8b9ac83479cf14d8651db.tar.xz
frr-ca317495b8aa18bfacf8b9ac83479cf14d8651db.zip
nhrpd: Use strlcpy not unsafe strncpy
Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
Diffstat (limited to 'nhrpd')
-rw-r--r--nhrpd/linux.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/nhrpd/linux.c b/nhrpd/linux.c
index 20825149b..e729f7264 100644
--- a/nhrpd/linux.c
+++ b/nhrpd/linux.c
@@ -32,6 +32,11 @@
#include "os.h"
#include "netlink.h"
+#ifndef HAVE_STRLCPY
+size_t strlcpy(char *__restrict dest,
+ const char *__restrict src, size_t destsize);
+#endif
+
static int nhrp_socket_fd = -1;
int os_socket(void)
@@ -112,7 +117,7 @@ static int linux_configure_arp(const char *iface, int on)
{
struct ifreq ifr;
- strncpy(ifr.ifr_name, iface, IFNAMSIZ - 1);
+ strlcpy(ifr.ifr_name, iface, IFNAMSIZ);
if (ioctl(nhrp_socket_fd, SIOCGIFFLAGS, &ifr))
return -1;