Replace remainining strncpy() uses with strlcpy()

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-10-26 11:42:09 +03:00
parent 41c526f357
commit 24f051eb14
4 changed files with 6 additions and 6 deletions

View file

@ -894,7 +894,7 @@ static int atheros_set_qos_map(void *ctx, const u8 *qos_map_set,
memset(&req, 0, sizeof(struct ieee80211req_athdbg)); memset(&req, 0, sizeof(struct ieee80211req_athdbg));
req.cmd = IEEE80211_DBGREQ_SETQOSMAPCONF; req.cmd = IEEE80211_DBGREQ_SETQOSMAPCONF;
os_memset(&iwr, 0, sizeof(iwr)); os_memset(&iwr, 0, sizeof(iwr));
os_strncpy(iwr.ifr_name, drv->iface, sizeof(iwr.ifr_name)); os_strlcpy(iwr.ifr_name, drv->iface, sizeof(iwr.ifr_name));
iwr.u.data.pointer = (void *) &req; iwr.u.data.pointer = (void *) &req;
iwr.u.data.length = sizeof(struct ieee80211req_athdbg); iwr.u.data.length = sizeof(struct ieee80211req_athdbg);
} }
@ -1385,7 +1385,7 @@ static void fetch_pending_big_events(struct atheros_driver_data *drv)
while (1) { while (1) {
os_memset(&iwr, 0, sizeof(iwr)); os_memset(&iwr, 0, sizeof(iwr));
os_strncpy(iwr.ifr_name, drv->iface, IFNAMSIZ); os_strlcpy(iwr.ifr_name, drv->iface, IFNAMSIZ);
iwr.u.data.pointer = (void *) tbuf; iwr.u.data.pointer = (void *) tbuf;
iwr.u.data.length = sizeof(tbuf); iwr.u.data.length = sizeof(tbuf);

View file

@ -72,7 +72,7 @@ get80211opmode(struct bsd_driver_data *drv)
struct ifmediareq ifmr; struct ifmediareq ifmr;
(void) memset(&ifmr, 0, sizeof(ifmr)); (void) memset(&ifmr, 0, sizeof(ifmr));
(void) strncpy(ifmr.ifm_name, drv->ifname, sizeof(ifmr.ifm_name)); (void) os_strlcpy(ifmr.ifm_name, drv->ifname, sizeof(ifmr.ifm_name));
if (ioctl(drv->sock, SIOCGIFMEDIA, (caddr_t)&ifmr) >= 0) { if (ioctl(drv->sock, SIOCGIFMEDIA, (caddr_t)&ifmr) >= 0) {
if (ifmr.ifm_current & IFM_IEEE80211_ADHOC) { if (ifmr.ifm_current & IFM_IEEE80211_ADHOC) {

View file

@ -3187,7 +3187,7 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
genlmsg_attrlen(gnlh, 0), NULL); genlmsg_attrlen(gnlh, 0), NULL);
if (tb[NL80211_ATTR_WIPHY_NAME]) if (tb[NL80211_ATTR_WIPHY_NAME])
os_strncpy(drv->phyname, os_strlcpy(drv->phyname,
nla_get_string(tb[NL80211_ATTR_WIPHY_NAME]), nla_get_string(tb[NL80211_ATTR_WIPHY_NAME]),
sizeof(drv->phyname)); sizeof(drv->phyname));
if (tb[NL80211_ATTR_MAX_NUM_SCAN_SSIDS]) if (tb[NL80211_ATTR_MAX_NUM_SCAN_SSIDS])
@ -10656,7 +10656,7 @@ static int android_pno_start(struct i802_bss *bss,
memset(&ifr, 0, sizeof(ifr)); memset(&ifr, 0, sizeof(ifr));
memset(&priv_cmd, 0, sizeof(priv_cmd)); memset(&priv_cmd, 0, sizeof(priv_cmd));
os_strncpy(ifr.ifr_name, bss->ifname, IFNAMSIZ); os_strlcpy(ifr.ifr_name, bss->ifname, IFNAMSIZ);
priv_cmd.buf = buf; priv_cmd.buf = buf;
priv_cmd.used_len = bp; priv_cmd.used_len = bp;

View file

@ -2427,7 +2427,7 @@ static int wext_sched_scan(void *priv, struct wpa_driver_scan_params *params,
bp += WEXT_PNO_MAX_REPEAT_LENGTH + 1; bp += WEXT_PNO_MAX_REPEAT_LENGTH + 1;
os_memset(&iwr, 0, sizeof(iwr)); os_memset(&iwr, 0, sizeof(iwr));
os_strncpy(iwr.ifr_name, drv->ifname, IFNAMSIZ); os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
iwr.u.data.pointer = buf; iwr.u.data.pointer = buf;
iwr.u.data.length = bp; iwr.u.data.length = bp;