parse_netif_str(): improve NETIF= param parsing

Function parse_netif_str() is used to parse a value of NETIF=
configuration filefile parameter.

Network interface name can be up to IFNAMSIZE long, and while '\0' at
the end is not required, kernel discards the last character and puts
'\0', like this:

	memcpy(dev_name, name, IFNAMSIZ - 1);
	dev_name[IFNAMSIZ - 1] = '\0';

Therefore, we should error out if interface name length is longer than
IFNAMSIZE - 1. While at it, use snprintf to make sure it is
null-terminated (same as it is implemented in parse_netif_str_cmd()).

Reported-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
1 file changed