cisco / joy

A package for capturing and analyzing network flow data and intraflow data, for network research, forensics, and security monitoring.
Other
1.3k stars 329 forks source link

not validated against ioctl return value #272

Open devendranaga opened 5 years ago

devendranaga commented 5 years ago

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

https://github.com/cisco/joy/blob/47afb197763fea79138d7d92e07ba790cbb966b3/src/joy.c#L289

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.