forecast: Restrict strncpy() call

Closes strongswan/strongswan#331.
This commit is contained in:
Noel Kuntze
2021-05-04 14:48:53 +02:00
committed by Tobias Brunner
parent 2b89676157
commit e9a55abce4
@@ -361,7 +361,8 @@ static int get_ifindex(private_kernel_listener_t *this, char *ifname)
{
struct ifreq ifr = {};
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
strncpy(ifr.ifr_name, ifname, IFNAMSIZ-1);
if (ioctl(this->raw, SIOCGIFINDEX, &ifr) == 0)
{
return ifr.ifr_ifindex;