diff options
author | Tobias Brunner <tobias@strongswan.org> | 2012-06-25 16:01:51 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-07-16 14:53:35 +0200 |
commit | f1c78cfee7cb1d7ed2e23ac1935304cf5ae3d815 (patch) | |
tree | 0fe11d68b32d057f78935b294b9bb1c47cd4a8a9 /src/libcharon | |
parent | 1bb9c51e87b07a19ff97c72d3acb64c4f05f5573 (diff) | |
download | strongswan-f1c78cfee7cb1d7ed2e23ac1935304cf5ae3d815.tar.bz2 strongswan-f1c78cfee7cb1d7ed2e23ac1935304cf5ae3d815.tar.xz |
Check rng return value when generating ME CONNECT_ID and KEY
Diffstat (limited to 'src/libcharon')
-rw-r--r-- | src/libcharon/sa/ikev2/tasks/ike_me.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/libcharon/sa/ikev2/tasks/ike_me.c b/src/libcharon/sa/ikev2/tasks/ike_me.c index 333c13635..e19349971 100644 --- a/src/libcharon/sa/ikev2/tasks/ike_me.c +++ b/src/libcharon/sa/ikev2/tasks/ike_me.c @@ -291,9 +291,21 @@ METHOD(task_t, build_i, status_t, { /* only the initiator creates a connect ID. the responder * returns the connect ID that it received from the initiator */ - rng->allocate_bytes(rng, ME_CONNECTID_LEN, &this->connect_id); + if (!rng->allocate_bytes(rng, ME_CONNECTID_LEN, + &this->connect_id)) + { + DBG1(DBG_IKE, "unable to generate ID for ME_CONNECT"); + rng->destroy(rng); + return FAILED; + } + } + if (!rng->allocate_bytes(rng, ME_CONNECTKEY_LEN, + &this->connect_key)) + { + DBG1(DBG_IKE, "unable to generate connect key for ME_CONNECT"); + rng->destroy(rng); + return FAILED; } - rng->allocate_bytes(rng, ME_CONNECTKEY_LEN, &this->connect_key); rng->destroy(rng); message->add_notify(message, FALSE, ME_CONNECTID, this->connect_id); |