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

Use input if default not set for parsing file name #2026

Closed
skliper opened this issue Jan 18, 2022 · 0 comments · Fixed by #2027 or #2019
Closed

Use input if default not set for parsing file name #2026

skliper opened this issue Jan 18, 2022 · 0 comments · Fixed by #2027 or #2019
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Jan 18, 2022

Is your feature request related to a problem? Please describe.
CFE_FS_ParseInputFileName handler sets output to input as last resort (avoids uninit vars). CFE_FS_ParseInputFileNameEx only sets the output to default if default isn't null, so there's cases in the ES unit test where the output isn't initialized since there is no default value.

if (status >= 0 && UT_Stub_CopyToLocal(UT_KEY(CFE_FS_ParseInputFileNameEx), OutputBuffer, OutputBufSize) == 0 &&
OutputBufSize > 0 && DefaultInput != NULL)
{
/* Otherwise fall back to simple copy */
strncpy(OutputBuffer, DefaultInput, OutputBufSize);
}

Describe the solution you'd like
If DefaultInput is NULL, use InputName

Describe alternatives you've considered
None

Additional context
Any unit that uses CFE_FS_ParseInputFileNameEx with a NULL default risks uninit var, example:

Result = CFE_FS_ParseInputFileNameEx(StartParams.BasicInfo.FileName, cmd->AppFileName,
sizeof(StartParams.BasicInfo.FileName), sizeof(cmd->AppFileName), NULL,
CFE_FS_GetDefaultMountPoint(CFE_FS_FileCategory_DYNAMIC_MODULE),
CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_DYNAMIC_MODULE));

Requester Info
Jacob Hageman - NASA/GSFC

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