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
I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.
Describe the bug
It is not guarenteed that the source or destination arguments of strncpy for software bus message uses in ds/apps/fsw/src assure Null termination. Many standard functions such as strcpy, strlen, strcmp among others rely on arrays of characters to be Null terminated.
To Reproduce
From local ds repo, command grep -r strncpy and view uses where argument is a software bus message.
Expected behavior
No expected behavior changes. Replace strncpy with CFE_SB_MessageStringGet
Code snips
The below code snips are DS strncpy uses that do not guarentee null-termination
This strncpy example in FM may help with null-terminated destination but does not guarentee null-terminated source: FM strncpy example
System observed on:
imported from JSC static analysis audit
Additional context
The FM example above proves to assure Null termination for the destination, however, it may be best approach to replace strncpy with CFE_SB_MessageStringGet to consolidate handling of strings.
Reporter Info
Justin Figueroa, Vantage Systems
The text was updated successfully, but these errors were encountered:
Checklist (Please check before submitting)
Describe the bug
It is not guarenteed that the source or destination arguments of
strncpy
for software bus message uses in ds/apps/fsw/src assure Null termination. Many standard functions such as strcpy, strlen, strcmp among others rely on arrays of characters to be Null terminated.To Reproduce
From local ds repo, command
grep -r strncpy
and view uses where argument is a software bus message.Expected behavior
No expected behavior changes. Replace
strncpy
withCFE_SB_MessageStringGet
Code snips
The below code snips are DS strncpy uses that do not guarentee null-termination
DS/fsw/src/ds_cmds.c
Line 742 in 04c0154
DS/fsw/src/ds_cmds.c
Line 809 in 04c0154
DS/fsw/src/ds_cmds.c
Line 876 in 04c0154
This strncpy example in FM may help with null-terminated destination but does not guarentee null-terminated source:
FM strncpy example
System observed on:
imported from JSC static analysis audit
Additional context
The FM example above proves to assure Null termination for the destination, however, it may be best approach to replace
strncpy
withCFE_SB_MessageStringGet
to consolidate handling of strings.Reporter Info
Justin Figueroa, Vantage Systems
The text was updated successfully, but these errors were encountered: