The number of file descriptors in the message was not
determined correctly.
if(msg.msg_controllen > 0 && msg.msg_control != NULL
&& (cmsg = CMSG_FIRSTHDR(&msg)) != NULL)
{
if(msg.msg_controllen > 0 && msg.msg_control != NULL
&& (cmsg = CMSG_FIRSTHDR(&msg)) != NULL)
{
- rfds = (msg.msg_controllen - sizeof(struct cmsghdr)) / sizeof(int);
+ rfds = ((unsigned char *)cmsg + cmsg->cmsg_len - CMSG_DATA(cmsg)) / sizeof(int);
for(x = 0; x < nfds && x < rfds; x++)
{
for(x = 0; x < nfds && x < rfds; x++)
{