mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-26 04:09:30 +03:00
fix CID 164297: ensure -1 listen_fd is not passed to close
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
Fri Mar 10 16:22:54 CET 2017
|
||||
Handle case that we do not listen at all more gracefully
|
||||
in MHD_start_daemon() and not pass '-1' to helper functions
|
||||
that expect a valid socket. -CG
|
||||
|
||||
Tue Mar 7 12:11:44 BRT 2017
|
||||
Updates file `.gitignore`.
|
||||
|
||||
|
||||
@@ -5454,7 +5454,8 @@ MHD_start_daemon_va (unsigned int flags,
|
||||
listen_fd = daemon->listen_fd;
|
||||
}
|
||||
|
||||
if (!MHD_socket_nonblocking_ (listen_fd))
|
||||
if ( (MHD_INVALID_SOCKET != listen_fd) &&
|
||||
(! MHD_socket_nonblocking_ (listen_fd)) )
|
||||
{
|
||||
#ifdef HAVE_MESSAGES
|
||||
MHD_DLOG (daemon,
|
||||
@@ -5471,8 +5472,9 @@ MHD_start_daemon_va (unsigned int flags,
|
||||
goto free_and_fail;
|
||||
}
|
||||
}
|
||||
if ( (!MHD_SCKT_FD_FITS_FDSET_(listen_fd,
|
||||
NULL)) &&
|
||||
if ( (MHD_INVALID_SOCKET != listen_fd) &&
|
||||
(! MHD_SCKT_FD_FITS_FDSET_(listen_fd,
|
||||
NULL)) &&
|
||||
(0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL)) ) )
|
||||
{
|
||||
#ifdef HAVE_MESSAGES
|
||||
|
||||
Reference in New Issue
Block a user