From 9fb6cb810b769abbd60f11ef6e936a4e4456b19d Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Tue, 10 Oct 2017 09:50:56 +0100 Subject: [PATCH] Fix bug where early_data does not work if no SNI callback is present Fixes #4496 Reviewed-by: Rich Salz Reviewed-by: Ben Kaduk (Merged from https://github.com/openssl/openssl/pull/4519) --- ssl/statem/extensions.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ssl/statem/extensions.c b/ssl/statem/extensions.c index f6a200fa18..b5091ac5d6 100644 --- a/ssl/statem/extensions.c +++ b/ssl/statem/extensions.c @@ -834,6 +834,11 @@ static int final_server_name(SSL *s, unsigned int context, int sent, ret = s->session_ctx->ext.servername_cb(s, &altmp, s->session_ctx->ext.servername_arg); + if (!sent) { + OPENSSL_free(s->session->ext.hostname); + s->session->ext.hostname = NULL; + } + /* * If we're expecting to send a ticket, and tickets were previously enabled, * and now tickets are disabled, then turn off expected ticket. -- 2.25.1