Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use compile time assert on address length check in bind #861

Closed
skliper opened this issue Mar 10, 2021 · 0 comments · Fixed by #908 or #917
Closed

Use compile time assert on address length check in bind #861

skliper opened this issue Mar 10, 2021 · 0 comments · Fixed by #908 or #917
Assignees
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Mar 10, 2021

Is your feature request related to a problem? Please describe.
Known at compile time:

if (addrlen == 0 || addrlen > OS_SOCKADDR_MAX_LEN)

Describe the solution you'd like
Use CompileTimeAssert

Describe alternatives you've considered
What if sizeof(struct sockaddr_in6) is > OS_SOCKADDR_MAX_LEN but only AF_INET is used? Not really an error? Maybe only really known if OS_NETWORK_SUPPORTS_IPV6 is not defined?

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC, OSAL code review

@skliper skliper added this to the 6.0.0 milestone Mar 10, 2021
jphickey added a commit to jphickey/osal that referenced this issue Mar 15, 2021
OSAL provides an abstract buffer for socket addresses, independent
of the underlying implementation.  The size of this buffer is
configurable by the user via compile-time options.

This adds a CompileTimeAssert to confirm that the size of this
abstract buffer is large enough to store any of the enabled
address types. This also removes the need for runtime tests.
astrogeco added a commit that referenced this issue Mar 19, 2021
Fix #861, compile time assert for sockaddr size
astrogeco added a commit to astrogeco/osal that referenced this issue Mar 22, 2021
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants