summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAlin Nastac <alin.nastac@gmail.com>2020-10-08 13:31:37 +0200
committerHans Dedecker <dedeckeh@gmail.com>2020-10-10 09:39:58 +0200
commit64ff909328c095749ef6eaed7302b3e024409d2f (patch)
tree75965daf443938c31dca06c90262222d1ada0b52
parent55a7b6b7f2f773c06a79cb7359ffdab54ba32450 (diff)
system-linux: initialize ifreq struct before using it
Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
-rw-r--r--system-linux.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/system-linux.c b/system-linux.c
index 6778b1d..9188899 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -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;