system-linux: initialize ifreq struct before using it
authorAlin Nastac <alin.nastac@gmail.com>
Thu, 8 Oct 2020 11:31:37 +0000 (13:31 +0200)
committerHans Dedecker <dedeckeh@gmail.com>
Sat, 10 Oct 2020 07:39:58 +0000 (09:39 +0200)
Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
system-linux.c

index 6778b1d56c949c4aefa4980bdccc48e31419ff8c..91888990440e953898bedaf8739303ee68072ed8 100644 (file)
@@ -904,6 +904,8 @@ failure:
 int system_if_resolve(struct device *dev)
 {
        struct ifreq ifr;
+
+       memset(&ifr, 0, sizeof(ifr));
        strncpy(ifr.ifr_name, dev->ifname, sizeof(ifr.ifr_name) - 1);
        if (!ioctl(sock_ioctl, SIOCGIFINDEX, &ifr))
                return ifr.ifr_ifindex;