kernel-netlink: Fix compiler warnings with strncpy()

Normally, GCC sees that we terminate the destination with a zero byte.
However, when using `-fsanitize=address`, there seems to be additional
instrumentation code after strncpy() so GCC produces warnings like
these:

‘__builtin_strncpy’ specified bound 16 equals destination size [-Wstringop-truncation]
This commit is contained in:
Tobias Brunner
2022-09-15 12:16:12 +02:00
parent ae9d110dd9
commit eab9cd8661
2 changed files with 14 additions and 14 deletions
@@ -1126,7 +1126,7 @@ static void process_link(private_kernel_netlink_net_t *this,
);
this->ifaces->insert_last(this->ifaces, entry);
}
strncpy(entry->ifname, name, IFNAMSIZ);
strncpy(entry->ifname, name, IFNAMSIZ-1);
entry->ifname[IFNAMSIZ-1] = '\0';
entry->usable = charon->kernel->is_interface_usable(charon->kernel,
name);