Skip to content

Kernel protection failure when calling select() on a file descriptor larger than FD_SETSIZE #113

@azeteg

Description

@azeteg

I ran into this issue on macOS, in an application running a large number of sockets.

dnssd/servus.h sources use select() API calls inside of _handleEvents(). This only works well until the file descriptor reaches FD_SETSIZE. There is an error checking code for a valid file descriptor, but this code does not consider the fact that fd can be larger than zero and still invalid:

        assert(fd >= 0);
        if (fd < 0)
            return servus::Servus::Result(kDNSServiceErr_BadParam);

To continue using select() API call, one would need to check for it to be lower than FD_SETSIZE, but a better fix would be to switch to using poll() and WSAPoll() API calls.

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