Skip to content

Commit

Permalink
Check conf->sockfd against FD_SETSIZE. Fixes FreeRADIUS#24
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Feb 8, 2017
1 parent 9cb7569 commit 083214c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pam_radius_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 083214c

Please sign in to comment.