From: Jon Trulson Date: Mon, 10 Mar 2014 20:49:37 +0000 (-0600) Subject: mp_rpc_server.C: limit iteration of svc_fdset to FD_SETSIZE, as per spec. X-Git-Tag: 2.2.2~58 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9f0fbc30151f964bc92a3ba5772038eaf2492bf7;p=oweals%2Fcde.git 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. --- diff --git a/cde/lib/tt/slib/mp_rpc_server.C b/cde/lib/tt/slib/mp_rpc_server.C index 8292c86f..0bd690f1 100644 --- a/cde/lib/tt/slib/mp_rpc_server.C +++ b/cde/lib/tt/slib/mp_rpc_server.C @@ -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; }