eloop: Fix fd_table allocation for epoll and kqueue
The previous implementation did not work if the first registered socket
had fd > 16 or if the fd was more than double the largest value used in
previous registrations. Those cases could result in too small a memory
allocation being used and writes/reads beyond the end of that buffer.
This fix is applicable to CONFIG_ELOOP_EPOLL=y and CONFIG_ELOOP_KQUEUE=y
builds.
Fixes: f0356ec85c
("eloop: Add epoll option for better performance")
Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
89a7cdd690
commit
7153bd4674
1 changed files with 1 additions and 1 deletions
|
@ -301,7 +301,7 @@ static int eloop_sock_table_add_sock(struct eloop_sock_table *table,
|
|||
#endif /* CONFIG_ELOOP_POLL */
|
||||
#if defined(CONFIG_ELOOP_EPOLL) || defined(CONFIG_ELOOP_KQUEUE)
|
||||
if (new_max_sock >= eloop.max_fd) {
|
||||
next = eloop.max_fd == 0 ? 16 : eloop.max_fd * 2;
|
||||
next = new_max_sock + 16;
|
||||
temp_table = os_realloc_array(eloop.fd_table, next,
|
||||
sizeof(struct eloop_sock));
|
||||
if (temp_table == NULL)
|
||||
|
|
Loading…
Reference in a new issue