]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: check that received ifindex is valid
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 25 Jun 2020 04:13:47 +0000 (13:13 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 25 Jun 2020 04:13:47 +0000 (13:13 +0900)
src/network/networkd-manager.c

index 08666fd92d195495d38062e98a894afab3ed8177..63e2f61d299e302308034f04c8603d1a8d4150db 100644 (file)
@@ -1272,6 +1272,9 @@ int manager_rtnl_process_nexthop(sd_netlink *rtnl, sd_netlink_message *message,
         if (r < 0 && r != -ENODATA) {
                 log_warning_errno(r, "rtnl: could not get NHA_OIF attribute, ignoring: %m");
                 return 0;
+        } else if (tmp->oif <= 0) {
+                log_warning("rtnl: received nexthop message with invalid ifindex %d, ignoring.", tmp->oif);
+                return 0;
         }
 
         r = link_get(m, tmp->oif, &link);