Added checks for index in ThreadLocalStorage APIs (#552)

Added checks for ( xIndex >= 0 ) in ThreadLocalStorage APIs
diff --git a/tasks.c b/tasks.c
index bbd0b02..e4c3dea 100644
--- a/tasks.c
+++ b/tasks.c
@@ -3592,7 +3592,8 @@
     {

         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 );

@@ -3611,7 +3612,8 @@
         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 ];