fix: TOCTOU race condition in vTaskListTasks() + add .editorconfig#1409
Open
srpatcha wants to merge 5 commits intoFreeRTOS:mainfrom
Open
fix: TOCTOU race condition in vTaskListTasks() + add .editorconfig#1409srpatcha wants to merge 5 commits intoFreeRTOS:mainfrom
srpatcha wants to merge 5 commits intoFreeRTOS:mainfrom
Conversation
Enforce consistent 4-space indentation for C source files and proper line ending handling.
Read uxCurrentNumberOfTasks once into uxArraySize and use that local variable for both the size check and pvPortMalloc() call. The previous code read the volatile variable twice, allowing a task to be created between the reads, resulting in an undersized allocation that could cause a buffer overflow in uxTaskGetSystemState().
Signed-off-by: Srikanth Patchava <spatchava@meta.com>
Signed-off-by: Srikanth Patchava <spatchava@meta.com>
Signed-off-by: Srikanth Patchava <spatchava@meta.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Changes
1. Add .editorconfig for consistent code formatting
Adds a standard
.editorconfigfile to ensure consistent formatting across editors.2. Fix TOCTOU race condition in
vTaskListTasks()(tasks.c)vTaskListTasks()reads the volatileuxCurrentNumberOfTasksvariable twice — once to setuxArraySizeand again for thepvPortMalloc()call. If a task is created between the two reads, the allocated buffer is too small for the data written byuxTaskGetSystemState(), causing a buffer overflow.Fix: Use the local
uxArraySizevariable (already captured) for both the size check and the malloc call.