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

Fix #2581, Adding bytes read check #2584

Merged
merged 2 commits into from
Aug 2, 2024

Conversation

tandharia
Copy link

@tandharia tandharia commented Jul 22, 2024

Checklist (Please check before submitting)

Describe the contribution

Fixes #2581

  • Checks the return value of the read operation done in cfe_fs_api.c to make sure the correct number of bytes was read.
  • Handles cases where the read operation fails or reads fewer bytes than expected, preventing the use of uninitialized or partially initialized data.

Testing performed

Added a unit test to simulate scenario where the file read operation reads fewer bytes than expected.

Expected behavior changes

When a read operation fails, the system now exits the function early, preventing potential undefined behavior.

System(s) tested on

OS: Ubuntu 18.04

Contributor Info - All information REQUIRED for consideration of pull request

Tvisha Andharia - GSFC 582 intern

@dzbaker
Copy link
Collaborator

dzbaker commented Aug 1, 2024

CCB 1 Aug 2024: Approved pending workflow run.

@dzbaker dzbaker added CCB:Approved Indicates code review and approval by community CCB and removed CCB:Provisionally-Approved labels Aug 1, 2024
dzbaker added a commit to nasa/cFS that referenced this pull request Aug 2, 2024
*Combines:*

cFE equuleus-rc1+dev183

**Includes:**

*cFE*
- nasa/cFE#2579
- nasa/cFE#2565
- nasa/cFE#2584
- nasa/cFE#2585
- nasa/cFE#2586
- nasa/cFE#2326

Co-authored by: Tvisha Andharia <tandharia@users.noreply.github.com>
Co-authored by: Anh Van <avan989@users.noreply.github.com>
Co-authored by: Joseph Hickey <jphickey@users.noreply.github.com>
Co-authored by: Avi Weiss <thnkslprpt@users.noreply.github.com>
@dzbaker dzbaker merged commit 8244c18 into nasa:main Aug 2, 2024
21 checks passed
dzbaker added a commit to nasa/cFS that referenced this pull request Aug 2, 2024
*Combines:*

cFE equuleus-rc1+dev183

**Includes:**

*cFE*
- nasa/cFE#2579
- nasa/cFE#2565
- nasa/cFE#2584
- nasa/cFE#2585
- nasa/cFE#2586
- nasa/cFE#2326

Co-authored by: Tvisha Andharia <tandharia@users.noreply.github.com>
Co-authored by: Anh Van <avan989@users.noreply.github.com>
Co-authored by: Joseph Hickey <jphickey@users.noreply.github.com>
Co-authored by: Avi Weiss <thnkslprpt@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CCB:Approved Indicates code review and approval by community CCB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Possible Uninitialized Data Usage in CFE_FS_ReadHeader
3 participants