]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - ip/ipvrf.c
ip route: get: allow zero-length subnet mask
[mirror_iproute2.git] / ip / ipvrf.c
index e6fad32abd956c6159efce21ee06679d5ad3948f..08a0d45b2570f47167b0e55bae55f1776334996a 100644 (file)
@@ -74,7 +74,7 @@ static int vrf_identify(pid_t pid, char *name, size_t len)
                        if (end)
                                *end = '\0';
 
-                       strncpy(name, vrf, len - 1);
+                       strlcpy(name, vrf, len);
                        break;
                }
        }
@@ -336,8 +336,7 @@ static int vrf_path(char *vpath, size_t len)
                if (vrf)
                        *vrf = '\0';
 
-               strncpy(vpath, start, len - 1);
-               vpath[len - 1] = '\0';
+               strlcpy(vpath, start, len);
 
                /* if vrf path is just / then return nothing */
                if (!strcmp(vpath, "/"))
@@ -437,6 +436,8 @@ out2:
 out:
        free(mnt);
 
+       drop_cap();
+
        return rc;
 }
 
@@ -588,7 +589,7 @@ static int ipvrf_show(int argc, char **argv)
                return 0;
        }
 
-       if (ip_linkaddr_list(0, ipvrf_filter_req, &linfo, NULL) == 0) {
+       if (ip_link_list(ipvrf_filter_req, &linfo) == 0) {
                struct nlmsg_list *l;
                unsigned nvrf = 0;
                int n;