cisco/joy

not validated against ioctl return value

Opened this issue · 0 comments

this could result in a potential uninitalized memory access down the line.

joy/src/joy.c

Line 289 in 47afb19

ioctl(sock, SIOCGIFHWADDR, &ifr);

The code below ioctl is :

	sprintf((char*)mac_addr, "%02x%02x%02x%02x%02x%02x",
		(int)(unsigned char)ifr.ifr_hwaddr.sa_data[0],
		(int)(unsigned char)ifr.ifr_hwaddr.sa_data[1],
		(int)(unsigned char)ifr.ifr_hwaddr.sa_data[2],
		(int)(unsigned char)ifr.ifr_hwaddr.sa_data[3],
		(int)(unsigned char)ifr.ifr_hwaddr.sa_data[4],
(int)(unsigned char)ifr.ifr_hwaddr.sa_data[5]);

And the get_mac_address OS specific code could be refactored into small functions as well.