un-initialized key contexts after copying struct

pull/2/merge
Richard Fuchs 12 years ago
parent 0a4418cd4b
commit f6d91122af

@ -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;

@ -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;
}

Loading…
Cancel
Save