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

Clean up strncpy use #1089

Closed
skliper opened this issue Jan 12, 2021 · 0 comments · Fixed by #1098 or #1109
Closed

Clean up strncpy use #1089

skliper opened this issue Jan 12, 2021 · 0 comments · Fixed by #1098 or #1109
Assignees
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Jan 12, 2021

Is your feature request related to a problem? Please describe.
Still occasionally using hardcoded defines for the character array length. Better to use sizeof to simplify maintenance. Also not always setting last character null.

Example:

char CDSName[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN] = {""};

...
strncpy(CDSName, Name, CFE_MISSION_ES_CDS_MAX_NAME_LENGTH);
CDSName[CFE_MISSION_ES_CDS_MAX_NAME_LENGTH-1] = '\0';

Describe the solution you'd like
Use sizeof.

Describe alternatives you've considered
None

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

@skliper skliper changed the title Clean up strncpy use in the main code Clean up strncpy use Jan 12, 2021
skliper added a commit to skliper/cFE that referenced this issue Jan 12, 2021
skliper added a commit to skliper/cFE that referenced this issue Jan 13, 2021
skliper added a commit to skliper/cFE that referenced this issue Jan 13, 2021
skliper added a commit to skliper/cFE that referenced this issue Jan 13, 2021
@skliper skliper self-assigned this Jan 13, 2021
@skliper skliper added this to the 7.0.0 milestone Jan 13, 2021
skliper added a commit to skliper/cFE that referenced this issue Jan 13, 2021
skliper added a commit to skliper/cFE that referenced this issue Jan 13, 2021
skliper added a commit to skliper/cFE that referenced this issue Jan 13, 2021
skliper added a commit to skliper/cFE that referenced this issue Jan 14, 2021
skliper added a commit to skliper/cFE that referenced this issue Jan 14, 2021
astrogeco added a commit to astrogeco/cFE that referenced this issue Jan 25, 2021
Fix nasa#1089, Cleanup strncpy use - unit tests
Fix nasa#1089, Cleanup strncpy use - main code

Fix nasa#932, Update UT for CFE_MISSION* string sizing
skliper added a commit to skliper/cFE that referenced this issue Jan 25, 2021
skliper added a commit to skliper/cFE that referenced this issue Jan 25, 2021
astrogeco added a commit that referenced this issue Jan 25, 2021
Fix #932 and #1089, strncpy cleanup and UT updates for mission sizing of API_LEN and PATH_LEN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment