Skip to content

Commit

Permalink
main: fix Array out of bounds access
Browse files Browse the repository at this point in the history
  • Loading branch information
jobo-zt committed Sep 4, 2024
1 parent 1bf492a commit 222f032
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,14 +755,13 @@ static int fd_poll(struct re *re)
FD_ZERO(&wfds);
FD_ZERO(&efds);

for (i = 0; cfds < nfds; i++) {
for (i = 0; (i < re->maxfds) && (cfds < nfds); i++) {
fhs = re->fhsl[i];

++cfds;
if (!fhs || !fhs->fh)
continue;

++cfds;

re_sock_t fd = fhs->fd;
if (fhs->flags & FD_READ)
FD_SET(fd, &rfds);
Expand Down

0 comments on commit 222f032

Please sign in to comment.