Use strncmp rather than strcmp in netlink.c when fetching the interface

MAC address and index.
This commit is contained in:
Nicholas J. Kain
2014-03-12 13:03:34 -04:00
parent fac6794b6c
commit 765f3de274
3 changed files with 7 additions and 3 deletions

View File

@ -58,7 +58,9 @@ static void get_if_index_and_mac(const struct nlmsghdr *nlh,
nl_attr_parse(nlh, sizeof *ifm, nlrtattr_assign, tb);
if (!tb[IFLA_IFNAME])
return;
if (!strcmp(client_config.interface, nlattr_get_data(tb[IFLA_IFNAME]))) {
if (!strncmp(client_config.interface,
nlattr_get_data(tb[IFLA_IFNAME]),
sizeof client_config.interface)) {
client_config.ifindex = ifm->ifi_index;
if (!tb[IFLA_ADDRESS])
suicide("FATAL: Adapter %s lacks a hardware address.");