From f6d91122afc26afad3724d7137729dd6652caaaa Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 25 Jun 2013 09:36:52 -0400 Subject: [PATCH] un-initialized key contexts after copying struct --- daemon/call.c | 1 + daemon/crypto.h | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/daemon/call.c b/daemon/call.c index 9024d1837..ab32bce71 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1377,6 +1377,7 @@ static void steal_peer(struct peer *dest, struct peer *src) { sr->stun = srs->stun; sr->rtcp = srs->rtcp; sr->crypto = srs->crypto; + crypto_context_pair_uninit(&srs->crypto); srs->fd.fd = -1; diff --git a/daemon/crypto.h b/daemon/crypto.h index f87b9bfcb..7baec7205 100644 --- a/daemon/crypto.h +++ b/daemon/crypto.h @@ -115,6 +115,12 @@ static inline void crypto_cleanup(struct crypto_context *c) { if (c->crypto_suite->session_key_cleanup) c->crypto_suite->session_key_cleanup(c); } +static inline void crypto_context_pair_uninit(struct crypto_context_pair *p) { + p->in.session_key_ctx[0] = NULL; + p->in.session_key_ctx[1] = NULL; + p->out.session_key_ctx[0] = NULL; + p->out.session_key_ctx[1] = NULL; +}