Skip to content

not validated against ioctl return value #272

Open
@devendranaga

Description

@devendranaga

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions