Skip to content

Commit

Permalink
Fix possible uninitialised values in struct ifreq
Browse files Browse the repository at this point in the history
  • Loading branch information
emanuele-f committed Sep 22, 2019
1 parent 0538c52 commit b889795
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tuntap_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ static int setup_ifname(int fd, const char *ifname, const char *ipaddr,
const char *netmask, const char *mac, int mtu) {
struct ifreq ifr;

memset(&ifr, 0, sizeof(ifr));

strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
ifr.ifr_name[IFNAMSIZ-1] = '\0';

Expand Down

0 comments on commit b889795

Please sign in to comment.