Skip to content

Commit 00ca174

Browse files
AniruddhaKanherechinglee-iot
authored andcommitted
Added checks for index in ThreadLocalStorage APIs (FreeRTOS#552)
Added checks for ( xIndex >= 0 ) in ThreadLocalStorage APIs
1 parent 204f08c commit 00ca174

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tasks.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4907,7 +4907,8 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
49074907
{
49084908
TCB_t * pxTCB;
49094909

4910-
if( xIndex < configNUM_THREAD_LOCAL_STORAGE_POINTERS )
4910+
if( ( xIndex >= 0 ) &&
4911+
( xIndex < configNUM_THREAD_LOCAL_STORAGE_POINTERS ) )
49114912
{
49124913
pxTCB = prvGetTCBFromHandle( xTaskToSet );
49134914
configASSERT( pxTCB != NULL );
@@ -4926,7 +4927,8 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
49264927
void * pvReturn = NULL;
49274928
TCB_t * pxTCB;
49284929

4929-
if( xIndex < configNUM_THREAD_LOCAL_STORAGE_POINTERS )
4930+
if( ( xIndex >= 0 ) &&
4931+
( xIndex < configNUM_THREAD_LOCAL_STORAGE_POINTERS ) )
49304932
{
49314933
pxTCB = prvGetTCBFromHandle( xTaskToQuery );
49324934
pvReturn = pxTCB->pvThreadLocalStoragePointers[ xIndex ];

0 commit comments

Comments
 (0)