iwinfo: assign explicit length to IWINFO_*_NAMES[] to fix compile issues
[project/iwinfo.git] / iwinfo_nl80211.c
index 4add5f4..67d551c 100644 (file)
@@ -218,9 +218,6 @@ static struct nl80211_msg_conveyor * nl80211_new(struct genl_family *family,
        return &cv;
 
 err:
-       if (cb)
-               nl_cb_put(cb);
-
        if (req)
                nlmsg_free(req);
 
@@ -604,7 +601,7 @@ static char * nl80211_phy2ifname(const char *ifname)
                                            ((ifidx < 0) || (cifidx < ifidx)))
                                        {
                                                ifidx = cifidx;
-                                               strncpy(nif, e->d_name, sizeof(nif));
+                                               strncpy(nif, e->d_name, sizeof(nif) - 1);
                                        }
                                }
                        }
@@ -951,7 +948,7 @@ static void nl80211_hostapd_hup(const char *ifname)
        if (phy)
        {
                snprintf(buf, sizeof(buf), "/var/run/wifi-%s.pid", phy);
-               if ((fd = open(buf, O_RDONLY)) > 0)
+               if ((fd = open(buf, O_RDONLY)) >= 0)
                {
                        if (read(fd, buf, sizeof(buf)) > 0)
                                pid = atoi(buf);