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

Possible NULL ptr deference in CFE_ES_StartAppTask #2491

Open
ejtimmon opened this issue Jan 5, 2024 · 1 comment
Open

Possible NULL ptr deference in CFE_ES_StartAppTask #2491

ejtimmon opened this issue Jan 5, 2024 · 1 comment

Comments

@ejtimmon
Copy link
Contributor

ejtimmon commented Jan 5, 2024

Describe the bug
Static code analysis finding from the Klocwork tool. Line numbers based on the draco-rc4 tag. On line 606 in the cfe_es_apps.c file, the function CFE_ES_LocateTaskRecordByID could return a value of NULL. This will then set TaskRecPtr to NULL. Then on line 607 TaskRecPtr will be dereferenced.

To Reproduce
Run Klocwork SCA analysis

Reporter Info
Beth Geist/NASA GSFC

@jphickey
Copy link
Contributor

jphickey commented Jan 5, 2024

This is a false positive. I think it was "detected" by tools in the past, hence the comment here:

/*
* As this is a newly-created task, this shouldn't fail.
* The entry is not (yet) matching the task ID - it will be
* initialized here.
*/
LocalTaskId = CFE_ES_TaskId_FromOSAL(OsalTaskId);

Basically - the CFE_ES_TaskId_FromOSAL() call can never fail, it always produces a valid ID, and thus CFE_ES_LocateTaskRecordByID() always returns non-NULL in this context. If we added an "if" to check for it, it would end up being unreachable code.

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

No branches or pull requests

2 participants