Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not validated against ioctl return value #272

Open
devendranaga opened this issue Jun 27, 2019 · 0 comments
Open

not validated against ioctl return value #272

devendranaga opened this issue Jun 27, 2019 · 0 comments

Comments

@devendranaga
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant