diff options
author | Lukas Larsson <lukas@erlang.org> | 2020-04-16 17:29:42 +0200 |
---|---|---|
committer | Lukas Larsson <lukas@erlang.org> | 2020-04-16 17:29:44 +0200 |
commit | ffb26e566c0cfc963883bb3e846e68d7a7c71cb0 (patch) | |
tree | 2e890107e4bdd2b3c16c83a3b1e7eb491f8e3d1c /erts | |
parent | e9f3739d7f346006e9564f1d98a15052544d2720 (diff) | |
download | erlang-ffb26e566c0cfc963883bb3e846e68d7a7c71cb0.tar.gz |
epmd: Validate that the FD fits in the set
On some OSs (NetBSD) we get larger FDs then we should based on the
number of files open to we have to check that the FD actually
fits in the fd_set.
Diffstat (limited to 'erts')
-rw-r--r-- | erts/epmd/src/epmd_srv.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/erts/epmd/src/epmd_srv.c b/erts/epmd/src/epmd_srv.c index 2f4f189bb4..c37ca197f5 100644 --- a/erts/epmd/src/epmd_srv.c +++ b/erts/epmd/src/epmd_srv.c @@ -1054,6 +1054,12 @@ static int conn_open(EpmdVars *g,int fd) int i; Connection *s; + if (fd >= FD_SETSIZE) { + dbg_tty_printf(g,0,"fd does not fit in fd_set fd=%d, FD_SETSIZE=%d",fd, FD_SETSIZE); + close(fd); + return EPMD_FALSE; + } + for (i = 0; i < g->max_conn; i++) { if (g->conn[i].open == EPMD_FALSE) { g->active_conn++; |