Skip to content

Commit

Permalink
Never pass nullptr to EC_KEY_dup.
Browse files Browse the repository at this point in the history
Fixes ticket:4566.
  • Loading branch information
Cyp committed Mar 22, 2017
1 parent 1f23701 commit 3820778
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/framework/crc.cpp
Expand Up @@ -66,7 +66,7 @@ void EC_KEY_free(EC_KEY *key)
}
EC_KEY *EC_KEY_dup(EC_KEY const *key)
{
return key != nullptr ? new EC_KEY(*key) : nullptr;
return new EC_KEY(*key);
}
int EC_KEY_generate_key(EC_KEY *)
{
Expand Down Expand Up @@ -256,7 +256,7 @@ EcKey::EcKey()

EcKey::EcKey(EcKey const &b)
{
vKey = (void *)EC_KEY_dup((EC_KEY *)b.vKey);
vKey = b.vKey != nullptr ? (void *)EC_KEY_dup((EC_KEY *)b.vKey) : nullptr;
}

EcKey::EcKey(EcKey &&b)
Expand All @@ -273,7 +273,7 @@ EcKey::~EcKey()
EcKey &EcKey::operator =(EcKey const &b)
{
clear();
vKey = (void *)EC_KEY_dup((EC_KEY *)b.vKey);
vKey = b.vKey != nullptr ? (void *)EC_KEY_dup((EC_KEY *)b.vKey) : nullptr;
return *this;
}

Expand Down

0 comments on commit 3820778

Please sign in to comment.