Skip to content

Fix #2650, Correct input buffer size in fs_UT#2683

Open
heathdutton wants to merge 1 commit intonasa:mainfrom
heathdutton:fix-2650-fs-ut-input-buffer-size
Open

Fix #2650, Correct input buffer size in fs_UT#2683
heathdutton wants to merge 1 commit intonasa:mainfrom
heathdutton:fix-2650-fs-ut-input-buffer-size

Conversation

@heathdutton
Copy link

Checklist (Please check before submitting)

Describe the contribution

The Test_CFE_FS_ParseInputFileNameEx test passes an InputBufSize of 10 for an empty string literal "" which is only 1 byte. Address Sanitizer flags this as a read buffer overflow since the function is told it can read 10 bytes from a 1-byte buffer.

Fixes #2650

Testing performed

Code inspection. The empty string causes the function to take the early-out path at the InputBuffer[0] != 0 check, so the expected result CFE_FS_INVALID_PATH is unchanged regardless of the size value. The fix simply makes the declared size match reality.

Expected behavior changes

No behavior change. Test exercises the same code path and expects the same result.

System(s) tested on

N/A -- test-only change, verified by inspection

Additional context

N/A

Third party code

N/A

Contributor Info - All information REQUIRED for consideration of pull request

Heath Dutton / Personal

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.

Address Sanitizer flags a test in fs_UT.c as having a READ buffer overflow

1 participant