Check rng return value when generating challenges in eap-md5 and mschapv2 plugins

This commit is contained in:
Tobias Brunner
2012-07-16 14:53:36 +02:00
committed by Martin Willi
parent 7ae2671036
commit 162f489a27
2 changed files with 12 additions and 12 deletions
+2 -2
View File
@@ -119,11 +119,11 @@ METHOD(eap_method_t, initiate_server, status_t,
eap_md5_header_t *req;
rng = lib->crypto->create_rng(lib->crypto, RNG_WEAK);
if (!rng)
if (!rng || !rng->allocate_bytes(rng, CHALLENGE_LEN, &this->challenge))
{
DESTROY_IF(rng);
return FAILED;
}
rng->allocate_bytes(rng, CHALLENGE_LEN, &this->challenge);
rng->destroy(rng);
req = alloca(PAYLOAD_LEN);