aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2009-02-08 11:26:33 (GMT)
committerJouni Malinen <j@w1.fi>2009-02-15 13:05:25 (GMT)
commit45221c7014fd1f14a8dd6438537fe4cbc70483bf (patch)
treeb12c091f2db58a80920b50f96e7c97e5bdd3d0c7 /src
parent997831b5677f16e01e3929d3db7707cedee275ee (diff)
downloadhostap-06-45221c7014fd1f14a8dd6438537fe4cbc70483bf.zip
hostap-06-45221c7014fd1f14a8dd6438537fe4cbc70483bf.tar.gz
hostap-06-45221c7014fd1f14a8dd6438537fe4cbc70483bf.tar.bz2
Use os_strlcpy instead of os_strncpy when copying ifname
In theory, the ifname could be IFNAMSIZ characters long and there would not be room for null termination. (cherry picked from commit a3bfd14de1b9e7a89c0b610b0368d2dd7568d315)
Diffstat (limited to 'src')
-rw-r--r--src/wps/wps_upnp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wps/wps_upnp.c b/src/wps/wps_upnp.c
index 84afa34..6d2de0e 100644
--- a/src/wps/wps_upnp.c
+++ b/src/wps/wps_upnp.c
@@ -859,7 +859,7 @@ static int get_netif_info(const char *net_if, unsigned *ip_addr,
if (sock < 0)
goto fail;
- os_strncpy(req.ifr_name, net_if, sizeof(req.ifr_name));
+ os_strlcpy(req.ifr_name, net_if, sizeof(req.ifr_name));
if (ioctl(sock, SIOCGIFADDR, &req) < 0) {
wpa_printf(MSG_ERROR, "WPS UPnP: SIOCGIFADDR failed: %d (%s)",
errno, strerror(errno));
@@ -870,7 +870,7 @@ static int get_netif_info(const char *net_if, unsigned *ip_addr,
in_addr.s_addr = *ip_addr;
os_snprintf(*ip_addr_text, 16, "%s", inet_ntoa(in_addr));
- os_strncpy(req.ifr_name, net_if, sizeof(req.ifr_name));
+ os_strlcpy(req.ifr_name, net_if, sizeof(req.ifr_name));
if (ioctl(sock, SIOCGIFHWADDR, &req) < 0) {
wpa_printf(MSG_ERROR, "WPS UPnP: SIOCGIFHWADDR failed: "
"%d (%s)", errno, strerror(errno));