Skip to content

Commit

Permalink
Added checks for index in ThreadLocalStorage APIs (#552)
Browse files Browse the repository at this point in the history
Added checks for ( xIndex >= 0 ) in ThreadLocalStorage APIs
  • Loading branch information
AniruddhaKanhere committed Sep 1, 2022
1 parent d91cd6f commit 6324f6f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tasks.c
Expand Up @@ -3592,7 +3592,8 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
{
TCB_t * pxTCB;

if( xIndex < configNUM_THREAD_LOCAL_STORAGE_POINTERS )
if( ( xIndex >= 0 ) &&
( xIndex < configNUM_THREAD_LOCAL_STORAGE_POINTERS ) )
{
pxTCB = prvGetTCBFromHandle( xTaskToSet );
configASSERT( pxTCB != NULL );
Expand All @@ -3611,7 +3612,8 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
void * pvReturn = NULL;
TCB_t * pxTCB;

if( xIndex < configNUM_THREAD_LOCAL_STORAGE_POINTERS )
if( ( xIndex >= 0 ) &&
( xIndex < configNUM_THREAD_LOCAL_STORAGE_POINTERS ) )
{
pxTCB = prvGetTCBFromHandle( xTaskToQuery );
pvReturn = pxTCB->pvThreadLocalStoragePointers[ xIndex ];
Expand Down

0 comments on commit 6324f6f

Please sign in to comment.