Skip to content

fix(tbl): close file descriptor after table load command - #2830

Open
philphauler wants to merge 1 commit into
nasa:devfrom
philphauler:fix-2811-tbl-fd-leak
Open

fix(tbl): close file descriptor after table load command#2830
philphauler wants to merge 1 commit into
nasa:devfrom
philphauler:fix-2811-tbl-fd-leak

Conversation

@philphauler

@philphauler philphauler commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Checklist (Please check before submitting)

Describe the contribution

Fixes #2811. In CFE_TBL_LoadCmd(), the file descriptor opened by CFE_FS_OpenFileForReading() is never closed on any code path — success or error. Added 6 lines using the established OS_ObjectIdDefined() + OS_close() idiom already present in the codebase to close the descriptor after CFE_TBL_SetMetaDataFromFileHeader(), before CFE_TBL_TxnFinish().

Testing performed

Traced all code paths through CFE_TBL_LoadCmd() in cFE dev branch HEAD — confirmed no existing OS_close() call on the file descriptor opened at the start of the function. The fix follows the same pattern used elsewhere in the table module.

Expected behavior changes

Table load commands no longer leak the opened file descriptor. Repeated table loads no longer accumulate leaked descriptors.

System(s) tested on

Hardware: PC, OS: Windows 11, Versions: cFE dev branch HEAD

Contributor Info

Filip Koscak - phil.phaulre@gmail.com

Fixes nasa#2811: CFE_TBL_LoadCmd opens a file via TxnOpenTableLoadFile but
never closes it — TxnFinish only releases the registry lock. Every load
command leaks one OS file descriptor, eventually exhausting the OSAL
file table.
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

Successfully merging this pull request may close these issues.

[SECURITY] CFE_TBL_LoadCmd() file descriptor leak causes denial of service via resource exhaustion

2 participants