(doit_passive): check that fds are not too large to select on
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9101 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
		| @@ -493,9 +493,21 @@ doit_passive (kx_context *kc, | ||||
| 	int cookiesp = TRUE; | ||||
| 	        | ||||
| 	FD_ZERO(&fds); | ||||
| 	if (sock >= FD_SETSIZE) { | ||||
| 	    syslog (LOG_ERR, "fd too large"); | ||||
| 	    cleanup(nsockets, sockets); | ||||
| 	    return 1; | ||||
| 	} | ||||
|  | ||||
| 	FD_SET(sock, &fds); | ||||
| 	for (i = 0; i < nsockets; ++i) | ||||
| 	for (i = 0; i < nsockets; ++i) { | ||||
| 	    if (sockets[i].fd >= FD_SETSIZE) { | ||||
| 		syslog (LOG_ERR, "fd too large"); | ||||
| 		cleanup(nsockets, sockets); | ||||
| 		return 1; | ||||
| 	    } | ||||
| 	    FD_SET(sockets[i].fd, &fds); | ||||
| 	} | ||||
| 	ret = select(FD_SETSIZE, &fds, NULL, NULL, NULL); | ||||
| 	if(ret <= 0) | ||||
| 	    continue; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Assar Westerlund
					Assar Westerlund