mirror of
https://github.com/samba-team/samba.git
synced 2025-02-28 01:58:17 +03:00
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)
This commit is contained in:
parent
13301d8ec9
commit
2c8c82dd7f
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user