In ssl_sock_initial_ctx(), returns when SSL_CTX_new() failed instead of
trying to apply anything on the ctx. This may avoid crashing when
there's not enough memory anymore during configuration parsing.
Could be backported in every haproxy versions
const int default_min_ver = CONF_TLSV12;
ctx = SSL_CTX_new(SSLv23_server_method());
+ if (!ctx) {
+ cfgerr += 1;
+ ha_alert("Proxy '%s': failed to create an SSL context for bind '%s' at [%s:%d].\n",
+ bind_conf->frontend->id, bind_conf->arg, bind_conf->file, bind_conf->line);
+ goto end;
+ }
+
bind_conf->initial_ctx = ctx;
if (global_ssl.security_level > -1)
# endif
SSL_CTX_set_tlsext_servername_arg(ctx, bind_conf);
#endif /* ! SSL_CTRL_SET_TLSEXT_HOSTNAME */
+end:
return cfgerr;
}