[x] I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.
Describe the bugstring_variable[] in TO_LAB_SendDataTypes() is initialized with a 10-character-long string literal:
https://github.com/nasa/to_lab/blob/9e2ad8cccafaad6d09902213971344d9e277e9f9/fsw/src/to_lab_app.c#L381
However, the compiler will add on a terminating null character \0 as an additional (11th) character.
string_variable is later used as an array (not a string) where it is fine, obviously, to utilize all 10 of the array elements.
Nevertheless, it is still not ideal to have the array declared with a string literal that is too long (including the automatically added terminating null character) for its container.
Checklist
Describe the bug
string_variable[]
inTO_LAB_SendDataTypes()
is initialized with a 10-character-long string literal: https://github.com/nasa/to_lab/blob/9e2ad8cccafaad6d09902213971344d9e277e9f9/fsw/src/to_lab_app.c#L381 However, the compiler will add on a terminating null character\0
as an additional (11th) character.string_variable
is later used as an array (not a string) where it is fine, obviously, to utilize all 10 of the array elements. Nevertheless, it is still not ideal to have the array declared with a string literal that is too long (including the automatically added terminating null character) for its container.Expected behavior
char string_variable[10] = "ABCDEFGHI";
Alternative would be to just leave it uninitialized...
Reporter Info Avi Weiss @thnkslprpt