]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
netlink: check new interface name is valid or not before sending request
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 4 Mar 2019 02:24:33 +0000 (11:24 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 5 Mar 2019 01:02:09 +0000 (10:02 +0900)
src/libsystemd/sd-netlink/netlink-util.c

index 3928dfbabf352c149827a4c19ffa271916974ca5..628ce507a058e0f955333d13f57c6a251e5faa0d 100644 (file)
@@ -13,6 +13,9 @@ int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name) {
         assert(ifindex > 0);
         assert(name);
 
+        if (!ifname_valid(name))
+                return -EINVAL;
+
         if (!*rtnl) {
                 r = sd_netlink_open(rtnl);
                 if (r < 0)