Skip to content

Commit

Permalink
Add a check of the FD_SETSIZE before the call to select()
Browse files Browse the repository at this point in the history
Reviewed-by: Kurt Roeckx <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
  • Loading branch information
agrandi authored and mattcaswell committed Apr 6, 2016
1 parent 6985304 commit 570c071
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apps/speed.c
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,16 @@ static int run_benchmark(int async_jobs, int (*loop_function)(void *), loopargs_
max_fd = job_fd;
}

if (max_fd >= FD_SETSIZE) {
BIO_printf(bio_err,
"Error: max_fd (%d) must be smaller than FD_SETSIZE (%d). "
"Decrease the value of async_jobs\n",
max_fd, FD_SETSIZE);
ERR_print_errors(bio_err);
error = 1;
break;
}

select_result = select(max_fd + 1, &waitfdset, NULL, NULL, NULL);
if (select_result == -1 && errno == EINTR)
continue;
Expand Down

0 comments on commit 570c071

Please sign in to comment.