Update LoRaMac-node to Version 4.4.4,fix Security breach found by Tencent Blade Team please refer to security advisory - CVE-2020-11068
fix Security breach found by Tencent Blade Team please refer to security advisory - CVE-2020-11068
This commit is contained in:
@@ -66,7 +66,7 @@ typedef struct sLoRaMacConfirmQueueCtx
|
||||
/*
|
||||
* Callback function to notify the upper layer about context change
|
||||
*/
|
||||
EventNvmCtxChanged EventNvmCtxChanged;
|
||||
LoRaMacConfirmQueueNvmEvent LoRaMacConfirmQueueNvmEvent;
|
||||
/*!
|
||||
* Non-volatile module context.
|
||||
*/
|
||||
@@ -112,26 +112,47 @@ static MlmeConfirmQueue_t* DecreaseBufferPointer( MlmeConfirmQueue_t* bufferPoin
|
||||
return bufferPointer;
|
||||
}
|
||||
|
||||
static bool IsListEmpty( uint8_t count )
|
||||
{
|
||||
if( count == 0 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsListFull( uint8_t count )
|
||||
{
|
||||
if( count >= LORA_MAC_MLME_CONFIRM_QUEUE_LEN )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static MlmeConfirmQueue_t* GetElement( Mlme_t request, MlmeConfirmQueue_t* bufferStart, MlmeConfirmQueue_t* bufferEnd )
|
||||
{
|
||||
MlmeConfirmQueue_t* element = bufferStart;
|
||||
|
||||
while( element != bufferEnd )
|
||||
if( IsListEmpty( ConfirmQueueCtx.ConfirmQueueNvmCtx->MlmeConfirmQueueCnt ) == true )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for( uint8_t elementCnt = 0; elementCnt < ConfirmQueueCtx.ConfirmQueueNvmCtx->MlmeConfirmQueueCnt; elementCnt++ )
|
||||
{
|
||||
if( element->Request == request )
|
||||
{
|
||||
// We have found the element
|
||||
return element;
|
||||
}
|
||||
else
|
||||
{
|
||||
element = IncreaseBufferPointer( element );
|
||||
}
|
||||
element = IncreaseBufferPointer( element );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void LoRaMacConfirmQueueInit( LoRaMacPrimitives_t* primitives, EventNvmCtxChanged confirmQueueNvmCtxChanged )
|
||||
void LoRaMacConfirmQueueInit( LoRaMacPrimitives_t* primitives, LoRaMacConfirmQueueNvmEvent confirmQueueNvmCtxChanged )
|
||||
{
|
||||
ConfirmQueueCtx.Primitives = primitives;
|
||||
|
||||
@@ -151,7 +172,7 @@ void LoRaMacConfirmQueueInit( LoRaMacPrimitives_t* primitives, EventNvmCtxChange
|
||||
ConfirmQueueCtx.ConfirmQueueNvmCtx->CommonStatus = LORAMAC_EVENT_INFO_STATUS_ERROR;
|
||||
|
||||
// Assign callback
|
||||
ConfirmQueueCtx.EventNvmCtxChanged = confirmQueueNvmCtxChanged;
|
||||
ConfirmQueueCtx.LoRaMacConfirmQueueNvmEvent = confirmQueueNvmCtxChanged;
|
||||
}
|
||||
|
||||
bool LoRaMacConfirmQueueRestoreNvmCtx( void* confirmQueueNvmCtx )
|
||||
@@ -176,7 +197,7 @@ void* LoRaMacConfirmQueueGetNvmCtx( size_t* confirmQueueNvmCtxSize )
|
||||
|
||||
bool LoRaMacConfirmQueueAdd( MlmeConfirmQueue_t* mlmeConfirm )
|
||||
{
|
||||
if( ConfirmQueueCtx.ConfirmQueueNvmCtx->MlmeConfirmQueueCnt >= LORA_MAC_MLME_CONFIRM_QUEUE_LEN )
|
||||
if( IsListFull( ConfirmQueueCtx.ConfirmQueueNvmCtx->MlmeConfirmQueueCnt ) == true )
|
||||
{
|
||||
// Protect the buffer against overwrites
|
||||
return false;
|
||||
@@ -197,7 +218,7 @@ bool LoRaMacConfirmQueueAdd( MlmeConfirmQueue_t* mlmeConfirm )
|
||||
|
||||
bool LoRaMacConfirmQueueRemoveLast( void )
|
||||
{
|
||||
if( ConfirmQueueCtx.ConfirmQueueNvmCtx->MlmeConfirmQueueCnt == 0 )
|
||||
if( IsListEmpty( ConfirmQueueCtx.ConfirmQueueNvmCtx->MlmeConfirmQueueCnt ) == true )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -212,7 +233,7 @@ bool LoRaMacConfirmQueueRemoveLast( void )
|
||||
|
||||
bool LoRaMacConfirmQueueRemoveFirst( void )
|
||||
{
|
||||
if( ConfirmQueueCtx.ConfirmQueueNvmCtx->MlmeConfirmQueueCnt == 0 )
|
||||
if( IsListEmpty( ConfirmQueueCtx.ConfirmQueueNvmCtx->MlmeConfirmQueueCnt ) == true )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -229,7 +250,7 @@ void LoRaMacConfirmQueueSetStatus( LoRaMacEventInfoStatus_t status, Mlme_t reque
|
||||
{
|
||||
MlmeConfirmQueue_t* element = NULL;
|
||||
|
||||
if( ConfirmQueueCtx.ConfirmQueueNvmCtx->MlmeConfirmQueueCnt > 0 )
|
||||
if( IsListEmpty( ConfirmQueueCtx.ConfirmQueueNvmCtx->MlmeConfirmQueueCnt ) == false )
|
||||
{
|
||||
element = GetElement( request, ConfirmQueueCtx.BufferStart, ConfirmQueueCtx.BufferEnd );
|
||||
if( element != NULL )
|
||||
@@ -244,7 +265,7 @@ LoRaMacEventInfoStatus_t LoRaMacConfirmQueueGetStatus( Mlme_t request )
|
||||
{
|
||||
MlmeConfirmQueue_t* element = NULL;
|
||||
|
||||
if( ConfirmQueueCtx.ConfirmQueueNvmCtx->MlmeConfirmQueueCnt > 0 )
|
||||
if( IsListEmpty( ConfirmQueueCtx.ConfirmQueueNvmCtx->MlmeConfirmQueueCnt ) == false )
|
||||
{
|
||||
element = GetElement( request, ConfirmQueueCtx.BufferStart, ConfirmQueueCtx.BufferEnd );
|
||||
if( element != NULL )
|
||||
@@ -261,7 +282,7 @@ void LoRaMacConfirmQueueSetStatusCmn( LoRaMacEventInfoStatus_t status )
|
||||
|
||||
ConfirmQueueCtx.ConfirmQueueNvmCtx->CommonStatus = status;
|
||||
|
||||
if( ConfirmQueueCtx.ConfirmQueueNvmCtx->MlmeConfirmQueueCnt > 0 )
|
||||
if( IsListEmpty( ConfirmQueueCtx.ConfirmQueueNvmCtx->MlmeConfirmQueueCnt ) == false )
|
||||
{
|
||||
do
|
||||
{
|
||||
@@ -333,7 +354,7 @@ uint8_t LoRaMacConfirmQueueGetCnt( void )
|
||||
|
||||
bool LoRaMacConfirmQueueIsFull( void )
|
||||
{
|
||||
if( ConfirmQueueCtx.ConfirmQueueNvmCtx->MlmeConfirmQueueCnt >= LORA_MAC_MLME_CONFIRM_QUEUE_LEN )
|
||||
if( IsListFull( ConfirmQueueCtx.ConfirmQueueNvmCtx->MlmeConfirmQueueCnt ) == true )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user