summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2016-08-01 15:03:56 +1000
committerStefan Metzmacher <metze@samba.org>2016-08-10 11:24:36 +0200
commit2c8c82dd7fb110e5f5b7a5955a6d27a8f64c2fa9 (patch)
tree4117656f3748c88835f2914ecc05e5146a18d672
parent13301d8ec964b8154f33dfc67a83db010dcd2b15 (diff)
downloadsamba-2c8c82dd7fb110e5f5b7a5955a6d27a8f64c2fa9.tar.gz
ctdb-common: Consistently use strlcpy() on interface names
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12110 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit aff33a59479cafcb1f24a07ff76383d47bb196b3)
-rw-r--r--ctdb/common/system_linux.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ctdb/common/system_linux.c b/ctdb/common/system_linux.c
index 8bb18f836f0..b66ce670288 100644
--- a/ctdb/common/system_linux.c
+++ b/ctdb/common/system_linux.c
@@ -116,7 +116,7 @@ int ctdb_sys_send_arp(const ctdb_sock_addr *addr, const char *iface)
}
/* get the mac address */
- strncpy(if_hwaddr.ifr_name, iface, sizeof(if_hwaddr.ifr_name)-1);
+ strlcpy(if_hwaddr.ifr_name, iface, sizeof(if_hwaddr.ifr_name));
ret = ioctl(s, SIOCGIFHWADDR, &if_hwaddr);
if ( ret < 0 ) {
close(s);
@@ -210,7 +210,7 @@ int ctdb_sys_send_arp(const ctdb_sock_addr *addr, const char *iface)
}
/* get the mac address */
- strncpy(if_hwaddr.ifr_name, iface, sizeof(if_hwaddr.ifr_name)-1);
+ strlcpy(if_hwaddr.ifr_name, iface, sizeof(if_hwaddr.ifr_name));
ret = ioctl(s, SIOCGIFHWADDR, &if_hwaddr);
if ( ret < 0 ) {
close(s);
@@ -602,7 +602,7 @@ bool ctdb_sys_check_iface_exists(const char *iface)
return true;
}
- strncpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name)-1);
+ strlcpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name));
if (ioctl(s, SIOCGIFINDEX, &ifr) < 0 && errno == ENODEV) {
DEBUG(DEBUG_CRIT,(__location__ " interface '%s' not found\n", iface));
close(s);