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

Table Processing: strncmp incorrect size argument (CFE_TBL_MAX_FULL_NAME_LEN) #61

Closed
2 tasks done
colteye opened this issue Feb 7, 2023 · 0 comments · Fixed by #73
Closed
2 tasks done

Table Processing: strncmp incorrect size argument (CFE_TBL_MAX_FULL_NAME_LEN) #61

colteye opened this issue Feb 7, 2023 · 0 comments · Fixed by #73

Comments

@colteye
Copy link

colteye commented Feb 7, 2023

Checklist (Please check before submitting)

  • I reviewed the Contributing Guide.
  • I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.

Describe the bug
While compiling the latest version of CS, my build environment gave me the following error:

error: 'strncmp' specified bound 40 exceeds source size 20 [-Werror=stringop-overread]

Code snips
The bug relates to this line:

if (strncmp(OuterEntry->Name, (&StartOfTable[InnerLoop])->Name, CFE_TBL_MAX_FULL_NAME_LEN) == 0)

Based on checking the types for both table entries (CS_Def_App_Table_Entry_t), it seems that it would make sense to instead do the strncmp like so:

if (strncmp(OuterEntry->Name, (&StartOfTable[InnerLoop])->Name, OS_MAX_API_NAME) == 0)

After changing to this locally, my build works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants