1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

mp_rpc_server.C: limit iteration of svc_fdset to FD_SETSIZE, as per spec.

In init() there was code iterating over all of the possible file
descriptors in a svc_fdset.  fdsets are limited to FD_SETSIZE.  This
caused coredumps on FreeBSD 10, and possibly other hidden issues.

Moving to poll(), rather than select() would be better, but is a bigger
job.  For now, just limit to the FD_SETSIZE that select() requires.
This commit is contained in:
Jon Trulson 2014-03-10 14:49:37 -06:00
parent 9b9b3430ec
commit 9f0fbc3015

View file

@ -244,8 +244,7 @@ init(void (*service_fn)(struct svc_req *, SVCXPRT *))
(void)endnetconfig(handlep);
#endif /* OPT_TLI */
// now figure out what fd the rpc package is using
int maxfds = _tt_global->maxfds();
for (int i=0; i < maxfds; i++) {
for (int i=0; i < FD_SETSIZE; i++) {
if (FD_ISSET(i, &svc_fdset)) {
_rpc_fd = i;
}