From 57bd6aa7019734f599e23bdd75d6a75629df3aa6 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 10 Jun 2021 18:16:28 +0900 Subject: [PATCH] netlink: check input name is valid before calling netlink method --- src/libsystemd/sd-netlink/netlink-util.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libsystemd/sd-netlink/netlink-util.c b/src/libsystemd/sd-netlink/netlink-util.c index 0650f0b4752..4012725f4cd 100644 --- a/src/libsystemd/sd-netlink/netlink-util.c +++ b/src/libsystemd/sd-netlink/netlink-util.c @@ -274,6 +274,9 @@ int rtnl_resolve_link_alternative_name(sd_netlink **rtnl, const char *name) { assert(name); + if (!ifname_valid_full(name, IFNAME_VALID_ALTERNATIVE)) + return -EINVAL; + if (!rtnl) rtnl = &our_rtnl; if (!*rtnl) {