SHA256
1
0
forked from pool/krb5
krb5/krb5-1.6-MITKRB5-SA-2008-002.dif

77 lines
2.0 KiB
Plaintext

=== src/lib/rpc/svc.c
==================================================================
Index: src/lib/rpc/svc.c
===================================================================
--- src/lib/rpc/svc.c.orig
+++ src/lib/rpc/svc.c
@@ -109,15 +109,17 @@ xprt_register(SVCXPRT *xprt)
if (sock < FD_SETSIZE) {
xports[sock] = xprt;
FD_SET(sock, &svc_fdset);
+ if (sock > svc_maxfd)
+ svc_maxfd = sock;
}
#else
if (sock < NOFILE) {
xports[sock] = xprt;
svc_fds |= (1 << sock);
+ if (sock > svc_maxfd)
+ svc_maxfd = sock;
}
#endif /* def FD_SETSIZE */
- if (sock > svc_maxfd)
- svc_maxfd = sock;
}
/*
Index: src/lib/rpc/svc_tcp.c
===================================================================
--- src/lib/rpc/svc_tcp.c.orig
+++ src/lib/rpc/svc_tcp.c
@@ -53,6 +53,14 @@ static char sccsid[] = "@(#)svc_tcp.c 1.
extern errno;
*/
+#ifndef FD_SETSIZE
+#ifdef NBBY
+#define NOFILE (sizeof(int) * NBBY)
+#else
+#define NOFILE (sizeof(int) * 8)
+#endif
+#endif
+
/*
* Ops vector for TCP/IP based rpc service handle
*/
@@ -213,6 +221,19 @@ makefd_xprt(
register SVCXPRT *xprt;
register struct tcp_conn *cd;
+#ifdef FD_SETSIZE
+ if (fd >= FD_SETSIZE) {
+ (void) fprintf(stderr, "svc_tcp: makefd_xprt: fd too high\n");
+ xprt = NULL;
+ goto done;
+ }
+#else
+ if (fd >= NOFILE) {
+ (void) fprintf(stderr, "svc_tcp: makefd_xprt: fd too high\n");
+ xprt = NULL;
+ goto done;
+ }
+#endif
xprt = (SVCXPRT *)mem_alloc(sizeof(SVCXPRT));
if (xprt == (SVCXPRT *)NULL) {
(void) fprintf(stderr, "svc_tcp: makefd_xprt: out of memory\n");
@@ -268,6 +289,10 @@ rendezvous_request(
* make a new transporter (re-uses xprt)
*/
xprt = makefd_xprt(sock, r->sendsize, r->recvsize);
+ if (xprt == NULL) {
+ close(sock);
+ return (FALSE);
+ }
xprt->xp_raddr = addr;
xprt->xp_addrlen = len;
xprt->xp_laddr = laddr;