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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user