You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
In theory a negative value could reach this code through public APIs, which would lead to undefined isspace behavior as it gets converted to int.
I went back to the docs on this function, and it says this:
The c argument is an int, the value of which the application shall ensure is a character representable as an
unsigned char or equal to the value of the macro EOF. If the argument has any other value, the behavior is un‐
defined.
.... suggests that we actually should cast to unsigned char rather than int when using any of the ctype checks.
skliper
added a commit
to skliper/cFE
that referenced
this issue
Mar 16, 2021
Is your feature request related to a problem? Please describe.
In theory a negative value could reach this code through public APIs, which would lead to undefined isspace behavior as it gets converted to int.
cFE/fsw/cfe-core/src/es/cfe_es_syslog.c
Line 432 in 672b2dc
Describe the solution you'd like
Recommended practice is to cast to
unsigned char
, such that the conversion toint
results in defined behavior.Describe alternatives you've considered
Could adjust all the parameters involved to
unsigned char
, but probably not worth it.Additional context
Static analysis warning
Requester Info
Jacob Hageman - NASA/GSFC
The text was updated successfully, but these errors were encountered: