diff options
author | Rich Salz <rsalz@openssl.org> | 2017-04-24 09:41:51 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2017-04-24 09:41:51 -0400 |
commit | 26fb4b033c664df7e220db1960f1cdad73bbba06 (patch) | |
tree | b2d80e6608ffa72405cf809428bdf892e7424f07 /ssl/statem/statem_clnt.c | |
parent | cb2a6eb76ef7304a1b76ac5e2578cd9d5f59af28 (diff) |
if log fails, avoid pms getting double free
doing the pms assignment after log is successful
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3278)
Diffstat (limited to 'ssl/statem/statem_clnt.c')
-rw-r--r-- | ssl/statem/statem_clnt.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ssl/statem/statem_clnt.c b/ssl/statem/statem_clnt.c index 8207dde878..a8bb5663f0 100644 --- a/ssl/statem/statem_clnt.c +++ b/ssl/statem/statem_clnt.c @@ -2854,13 +2854,13 @@ static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt, int *al) goto err; } - s->s3->tmp.pms = pms; - s->s3->tmp.pmslen = pmslen; - /* Log the premaster secret, if logging is enabled. */ if (!ssl_log_rsa_client_key_exchange(s, encdata, enclen, pms, pmslen)) goto err; + s->s3->tmp.pms = pms; + s->s3->tmp.pmslen = pmslen; + return 1; err: OPENSSL_clear_free(pms, pmslen); |