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

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

Open
azeteg opened this issue Jun 29, 2023 · 0 comments · May be fixed by #115
Open

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

azeteg opened this issue Jun 29, 2023 · 0 comments · May be fixed by #115

Comments

@azeteg
Copy link

azeteg commented Jun 29, 2023

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.

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