forecast: Restrict strncpy() call

Closes strongswan/strongswan#331.
This commit is contained in:
Noel Kuntze 2021-04-17 05:02:01 +02:00 committed by Tobias Brunner
parent 2b89676157
commit e9a55abce4
1 changed files with 2 additions and 1 deletions

View File

@ -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;