Changeset 484186e in rtems-libbsd for ipsec-tools/src/racoon/session.c


Ignore:
Timestamp:
05/22/23 07:36:46 (6 months ago)
Author:
Christian Mauderer <christian.mauderer@…>
Branches:
5-freebsd-12
Parents:
29f9822
git-author:
Christian Mauderer <christian.mauderer@…> (05/22/23 07:36:46)
git-committer:
Christian Mauderer <christian.mauderer@…> (05/31/23 06:25:23)
Message:

ipsec-tools: Fix copying fd_set prior to select

The racoon session code copies an fd_set from one variable into another
prior to calling select. That works well for simple structures.

In libbsd we have to allocate fd_sets instead of using fixed structures
to avoid a problem with file numbers bigger than FD_SETSIZE. The simple
assignment didn't work in that case.

This patch makes sure that a memcpy is used instead.

Close #4914

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ipsec-tools/src/racoon/session.c

    r29f9822 r484186e  
    210210        FD_ZERO(&preset_mask);
    211211#else /* __rtems__ */
     212        size_t allocated_mask_size = sizeof(fd_set) *
     213            howmany(rtems_libio_number_iops, sizeof(fd_set) * 8);
    212214        allocated_preset_mask = calloc(sizeof(fd_set),
    213215            howmany(rtems_libio_number_iops, sizeof(fd_set) * 8));
     
    343345                /* schedular can change select() mask, so we reset
    344346                 * the working copy here */
     347#ifndef __rtems__
    345348                active_mask = preset_mask;
     349#else /* __rtems__ */
     350                memcpy(allocated_active_mask, allocated_preset_mask,
     351                    allocated_mask_size);
     352#endif /* __rtems__ */
    346353
    347354                error = select(nfds + 1, &active_mask, NULL, NULL, timeout);
Note: See TracChangeset for help on using the changeset viewer.