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

Infinite loop false alarm in unit test (easy fix) - static analysis warning #1184

Closed
skliper opened this issue Feb 26, 2021 · 3 comments · Fixed by #1444 or #1654
Closed

Infinite loop false alarm in unit test (easy fix) - static analysis warning #1184

skliper opened this issue Feb 26, 2021 · 3 comments · Fixed by #1444 or #1654
Assignees
Labels
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Feb 26, 2021

Is your feature request related to a problem? Please describe.
Static analysis warning on i being int8. Can be avoided if defined as size_t.

int8 i;
/* Copy the application name for later use */
strncpy(UT_subsys, subsys, sizeof(UT_subsys)-1);
UT_subsys[sizeof(UT_subsys)-1] = 0;
snprintf(UT_appname, 80, "ut_cfe_%s", subsys);
/* Convert to upper case */
for (i = 0; i < strlen(UT_subsys); ++i)

Based on logic strlen(UT_subsys) will never be bigger than int8 (unless someone redefines UT_subsys as something unreasonable) so this is a false alarm but easy to fix and better pattern to follow.

Describe the solution you'd like
Change to size_t

Describe alternatives you've considered
None

Additional context
Please wait until #972 is resolved.

Requester Info
Jacob Hageman - NASA/GSFC

@skliper skliper added good first issue Good for newcomers unit-test labels Feb 26, 2021
@himanshu007-creator
Copy link
Contributor

I would like to work on this issue.

@himanshu007-creator
Copy link
Contributor

@skliper Hi, as #972 is closed, so i assume it is resolved. So should i go for a PR for this issue?

@skliper
Copy link
Contributor Author

skliper commented Apr 28, 2021

@himanshu007-creator Yes please! You'll need to follow the PR template instructions to fill out and deliver a CLA before the PR can be merged. Thanks!

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