From a255d9f0c89b81c795980438a9d358525f8fb2c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Mon, 6 May 2019 16:45:11 +0200 Subject: [PATCH] * src/connect.c (select_fd): Check for negative fd --- src/connect.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/connect.c b/src/connect.c index 7b0dbbd4..14c5aea4 100644 --- a/src/connect.c +++ b/src/connect.c @@ -686,6 +686,9 @@ select_fd (int fd, double maxtime, int wait_for) struct timeval tmout; int result; + if (fd < 0) + return -1; + if (fd >= FD_SETSIZE) { logprintf (LOG_NOTQUIET, _("Too many fds open. Cannot use select on a fd >= %d\n"), FD_SETSIZE);