Skip to content

Commit 83115ba

Browse files
Added checks for index in ThreadLocalStorage APIs
Added checks for ( xIndex >= 0 ) in ThreadLocalStorage APIs
1 parent d91cd6f commit 83115ba

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
@@ -3592,7 +3592,8 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
35923592
{
35933593
TCB_t * pxTCB;
35943594

3595-
if( xIndex < configNUM_THREAD_LOCAL_STORAGE_POINTERS )
3595+
if( ( xIndex >= 0 ) &&
3596+
( xIndex < configNUM_THREAD_LOCAL_STORAGE_POINTERS ) )
35963597
{
35973598
pxTCB = prvGetTCBFromHandle( xTaskToSet );
35983599
configASSERT( pxTCB != NULL );
@@ -3611,7 +3612,8 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
36113612
void * pvReturn = NULL;
36123613
TCB_t * pxTCB;
36133614

3614-
if( xIndex < configNUM_THREAD_LOCAL_STORAGE_POINTERS )
3615+
if( ( xIndex >= 0 ) &&
3616+
( xIndex < configNUM_THREAD_LOCAL_STORAGE_POINTERS ) )
36153617
{
36163618
pxTCB = prvGetTCBFromHandle( xTaskToQuery );
36173619
pvReturn = pxTCB->pvThreadLocalStoragePointers[ xIndex ];

0 commit comments

Comments
 (0)