Skip to content

Commit

Permalink
Merge pull request #920 from jphickey/fix-919-fdset-check-id
Browse files Browse the repository at this point in the history
Fix #919, check index inside fdset conversions
  • Loading branch information
astrogeco authored Mar 22, 2021
2 parents 0876712 + cdd57c7 commit 1583e16
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/os/portable/os-impl-bsd-select.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ static int32 OS_FdSet_ConvertIn_Impl(int *os_maxfd, fd_set *os_set, const OS_FdS
bit = 0;
while (objids != 0)
{
if (objids & 0x01)
id = OSAL_INDEX_C((offset * 8) + bit);
if ((objids & 0x01) != 0 && id < OS_MAX_NUM_OPEN_FILES)
{
id = OSAL_INDEX_C((offset * 8) + bit);
osfd = OS_impl_filehandle_table[id].fd;
if (osfd >= 0 && OS_impl_filehandle_table[id].selectable)
{
Expand Down Expand Up @@ -142,9 +142,9 @@ static void OS_FdSet_ConvertOut_Impl(fd_set *output, OS_FdSet *Input)
bit = 0;
while (objids != 0)
{
if (objids & 0x01)
id = OSAL_INDEX_C((offset * 8) + bit);
if ((objids & 0x01) != 0 && id < OS_MAX_NUM_OPEN_FILES)
{
id = OSAL_INDEX_C((offset * 8) + bit);
osfd = OS_impl_filehandle_table[id].fd;
if (osfd < 0 || !FD_ISSET(osfd, output))
{
Expand Down

0 comments on commit 1583e16

Please sign in to comment.