Skip to content

Commit

Permalink
#177 Fix/Improvement - per SpicyDLL
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbrown6 committed Oct 13, 2023
1 parent 016729b commit a747faa
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/core/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,10 @@ int32_t Crypto_Check_Anti_Replay(SecurityAssociation_t* sa_ptr, uint8_t* arsn, u
int8_t ARSN_VALID = -1;

// Check for NULL pointers
if (sa_ptr == NULL) // #177 - Modification made per suggestion of 'Spicydll' - prevents null dereference
{
return CRYPTO_LIB_ERR_NULL_SA;
}
if (arsn == NULL && sa_ptr->arsn_len > 0)
{
return CRYPTO_LIB_ERR_NULL_ARSN;
Expand All @@ -820,10 +824,7 @@ int32_t Crypto_Check_Anti_Replay(SecurityAssociation_t* sa_ptr, uint8_t* arsn, u
{
return CRYPTO_LIB_ERR_NULL_IV;
}
if (sa_ptr == NULL)
{
return CRYPTO_LIB_ERR_NULL_SA;
}

// If sequence number field is greater than zero, check for replay
if (sa_ptr->shsnf_len > 0)
{
Expand Down

0 comments on commit a747faa

Please sign in to comment.