From 083214c90d93768e4628d7e0e4d56c54908aa49a Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Wed, 8 Feb 2017 13:32:09 -0500 Subject: Check conf->sockfd against FD_SETSIZE. Fixes #24 --- src/pam_radius_auth.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/pam_radius_auth.c b/src/pam_radius_auth.c index 0db57d5..f3a4326 100644 --- a/src/pam_radius_auth.c +++ b/src/pam_radius_auth.c @@ -618,6 +618,14 @@ static int initialize(radius_conf_t *conf, int accounting) return PAM_AUTHINFO_UNAVAIL; } +#ifndef HAVE_POLL_H + if (conf->sockfd >= FD_SETSIZE) { + _pam_log(LOG_ERR, "Unusable socket, FD is larger than %d\n", FD_SETSIZE); + close(conf->sockfd); + return PAM_AUTHINFO_UNAVAIL; + } +#endif + /* set up the local end of the socket communications */ s_in = (struct sockaddr_in *) &salocal; memset ((char *) s_in, '\0', sizeof(struct sockaddr)); -- cgit v1.2.3