Skip to content

Commit

Permalink
cpu: native: dev_eth_tap: fix possible null pointer deref
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspar030 committed Apr 11, 2015
1 parent 4228c70 commit f194b75
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cpu/native/ng_net/dev_eth_tap.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ static int _init(dev_eth_t *ethdev)
{
dev_eth_tap_t *dev = (dev_eth_tap_t*)ethdev;

/* check device parametrs */
if (dev == NULL) {
return -ENODEV;
}

char *name = dev->tap_name;
#ifdef __MACH__ /* OSX */
char clonedev[255] = "/dev/"; /* XXX bad size */
Expand All @@ -196,10 +201,6 @@ static int _init(dev_eth_t *ethdev)
struct ifreq ifr;
const char *clonedev = "/dev/net/tun";
#endif
/* check device parametrs */
if (dev == NULL) {
return -ENODEV;
}
/* initialize device descriptor */
dev->promiscous = 0;
/* implicitly create the tap interface */
Expand Down

0 comments on commit f194b75

Please # to comment.