Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent a FD_SET undefined behavior #427

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ AC_PROG_CXX
# Compiler flags.
AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug], [setup flags (gcc) for debugging (default=no)])],
if test "x$enable_debug" = xyes; then
CFLAGS="$CFLAGS -O2 -g"
CFLAGS="$CFLAGS -O0 -g"
fi
CPPFLAGS="$CPPFLAGS -DDEBUG"
LDFLAGS="$LDFLAGS",)
Expand Down
7 changes: 7 additions & 0 deletions src/data-types/mailstream_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,13 @@ static int wait_SSL_connect(int s, int want_read, time_t timeout_seconds)
timeout.tv_usec = 0;
}
#if defined(WIN32) || !USE_POLL
if (s >= FD_SETSIZE) {
#if defined(DEBUG)
/* too many opened connections? socket leaks? */
fprintf( stderr, "socket descriptor %d out of range\n", s);
#endif
return -1;
}
FD_ZERO(&fds);
FD_SET(s, &fds);
/* TODO: how to cancel this ? */
Expand Down