diff options
author | Tomas Mraz <tmraz@fedoraproject.org> | 2020-08-06 11:20:43 +0200 |
---|---|---|
committer | Tomas Mraz <tmraz@fedoraproject.org> | 2020-08-13 10:17:10 +0200 |
commit | dffeec1c10a874d7c7b83c221dbbce82f755edb1 (patch) | |
tree | 3f26806981fdeb3ba687e886a212f465d8c34a0d | |
parent | dd0164e7565bb14fac193aea4c2c37714bf66d56 (diff) |
Avoid segfault in SSL_export_keying_material if there is no session
Fixes #12588
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12594)
-rw-r--r-- | ssl/ssl_lib.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index f957664a48..c72341547a 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -3054,7 +3054,8 @@ int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen, const unsigned char *context, size_t contextlen, int use_context) { - if (s->version < TLS1_VERSION && s->version != DTLS1_BAD_VER) + if (s->session == NULL + || (s->version < TLS1_VERSION && s->version != DTLS1_BAD_VER)) return -1; return s->method->ssl3_enc->export_keying_material(s, out, olen, label, |