-
Notifications
You must be signed in to change notification settings - Fork 212
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
Unreasonable Size Argument - OS_CreateSocketName static analysis warning #817
Comments
skliper
added a commit
to skliper/osal
that referenced
this issue
Feb 17, 2021
astrogeco
added a commit
that referenced
this issue
Feb 24, 2021
Fix #817, Simplify name truncation in OS_CreateSocketName
jphickey
pushed a commit
to jphickey/osal
that referenced
this issue
Aug 10, 2022
Fix nasa#815, remove all deprecated code
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
Static analysis warns when using sizeof(sock->stream_name) in OS_strnlen check and later math
OS_MAX_API_NAME - len
passed to snprintf which out of context could then be a negative number (but isn't because OS_SocketAddrToString_Impl limits to OS_MAX_API_NAME, so this is a false positive):osal/src/os/shared/src/osapi-sockets.c
Lines 101 to 110 in ff4f523
Describe the solution you'd like
Truncating the port while fully adding the parent name or possibly even truncating both seems like it could be confusing. Just truncate at the end.
Describe alternatives you've considered
Could use OS_MAX_API_NAME to limit len in first check, but seems like overkill since the size is OS_MAX_PATH_LEN.
Additional context
Static analysis warning
Requester Info
Jacob Hageman - NASA/GSFC
The text was updated successfully, but these errors were encountered: