]> git.saurik.com Git - apple/libinfo.git/blobdiff - rpc.subproj/svc.c
Libinfo-222.3.3.tar.gz
[apple/libinfo.git] / rpc.subproj / svc.c
index fffefc0b9824a767a622cc1fbb14db869590e98e..b0a6a9ae6969277cc086c5434c7bf1d4250ed94a 100644 (file)
@@ -53,7 +53,7 @@
 #if defined(LIBC_SCCS) && !defined(lint) 
 /*static char *sccsid = "from: @(#)svc.c 1.44 88/02/08 Copyr 1984 Sun Micro";*/
 /*static char *sccsid = "from: @(#)svc.c       2.4 88/08/11 4.0 RPCSRC";*/
-static char *rcsid = "$Id: svc.c,v 1.2 1999/10/14 21:56:54 wsanchez Exp $";
+static char *rcsid = "$Id: svc.c,v 1.4 2002/02/19 20:36:24 epeyton Exp $";
 #endif
 
 /*
@@ -66,6 +66,8 @@ static char *rcsid = "$Id: svc.c,v 1.2 1999/10/14 21:56:54 wsanchez Exp $";
  * Copyright (C) 1984, Sun Microsystems, Inc.
  */
 
+#include <stdlib.h>
+#include <string.h>
 #include <sys/errno.h>
 #include <rpc/rpc.h>
 #include <rpc/pmap_clnt.h>
@@ -411,8 +413,11 @@ svc_getreqset(readfds)
 
 
        maskp = (u_long *)readfds->fds_bits;
-       for (sock = 0; sock < FD_SETSIZE; sock += NFDBITS) {
-           for (mask = *maskp++; bit = ffs(mask); mask ^= (1 << (bit - 1))) {
+       for (sock = 0; sock <= svc_maxfd; sock += NFDBITS) {
+           for (mask = *maskp++; (bit = ffs(mask)); mask ^= (1 << (bit - 1))) {
+               if ((sock + bit) > (svc_maxfd + 1))
+                       /* if we're past our sockets */
+                       return;
                /* sock has input waiting */
                xprt = xports[sock + bit - 1];
                if (xprt == NULL)