From: Matt Caswell Date: Tue, 10 Oct 2017 08:50:56 +0000 (+0100) Subject: Fix bug where early_data does not work if no SNI callback is present X-Git-Tag: OpenSSL_1_1_1-pre1~556 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9fb6cb810b769abbd60f11ef6e936a4e4456b19d;p=oweals%2Fopenssl.git 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) --- 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.