aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd/vlan_init.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2006-12-26 20:45:31 (GMT)
committerJouni Malinen <j@w1.fi>2006-12-26 20:45:31 (GMT)
commit9f119fd2649c767f073ca381d0cd383ea08296af (patch)
tree903072be39445d6f2b614c82a3357b01958656ef /hostapd/vlan_init.c
parent22606e453f237c96bb6bac069f6202953aa389e5 (diff)
downloadhostap-history-9f119fd2649c767f073ca381d0cd383ea08296af.zip
hostap-history-9f119fd2649c767f073ca381d0cd383ea08296af.tar.gz
hostap-history-9f119fd2649c767f073ca381d0cd383ea08296af.tar.bz2
Replace os_strncpy/strncpy calls with os_strlcpy to start using a more
secure function for copying strings. Only couple of existing strncpy() cases actually forced NUL-termination separately after the operation. This is now done within os_strlcpy(), so no external code for this is needed anymore.
Diffstat (limited to 'hostapd/vlan_init.c')
-rw-r--r--hostapd/vlan_init.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hostapd/vlan_init.c b/hostapd/vlan_init.c
index 2fec67f..590b2bc 100644
--- a/hostapd/vlan_init.c
+++ b/hostapd/vlan_init.c
@@ -54,7 +54,7 @@ static int ifconfig_helper(const char *if_name, int up)
}
memset(&ifr, 0, sizeof(ifr));
- strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
+ os_strlcpy(ifr.ifr_name, if_name, IFNAMSIZ);
if (ioctl(fd, SIOCGIFFLAGS, &ifr) != 0) {
perror("ioctl[SIOCGIFFLAGS]");
@@ -127,7 +127,7 @@ static int br_delif(const char *br_name, const char *if_name)
args[0] = BRCTL_DEL_IF;
args[1] = if_index;
- strncpy(ifr.ifr_name, br_name, sizeof(ifr.ifr_name));
+ os_strlcpy(ifr.ifr_name, br_name, sizeof(ifr.ifr_name));
ifr.ifr_data = (__caddr_t) args;
if (ioctl(fd, SIOCDEVPRIVATE, &ifr) < 0 && errno != EINVAL) {
@@ -173,7 +173,7 @@ static int br_addif(const char *br_name, const char *if_name)
args[0] = BRCTL_ADD_IF;
args[1] = if_index;
- strncpy(ifr.ifr_name, br_name, sizeof(ifr.ifr_name));
+ os_strlcpy(ifr.ifr_name, br_name, sizeof(ifr.ifr_name));
ifr.ifr_data = (__caddr_t) args;
if (ioctl(fd, SIOCDEVPRIVATE, &ifr) < 0) {
@@ -275,7 +275,7 @@ static int br_getnumports(const char *br_name)
arg[3] = 0;
memset(ifindices, 0, sizeof(ifindices));
- strncpy(ifr.ifr_name, br_name, sizeof(ifr.ifr_name));
+ os_strlcpy(ifr.ifr_name, br_name, sizeof(ifr.ifr_name));
ifr.ifr_data = (__caddr_t) arg;
if (ioctl(fd, SIOCDEVPRIVATE, &ifr) < 0) {