1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

Bugfix: SSL code should not free wsi

The SSL code should not do lws_free(new_wsi) here. The caller should clean up the wsi in libwebsocket_close_and_free_session. Instead this can potentially cause a crash during that call.

Also if we fail to create the SSL for hte listener we should indicate failure to the caller.
This commit is contained in:
=?UTF-8?q?Joakim=20S=C3=B6derberg?= 2015-06-25 17:14:44 +02:00 committed by Andy Green
parent 12f557b21d
commit 8361d34ff9

View file

@ -535,12 +535,12 @@ lws_server_socket_service_ssl(struct libwebsocket_context *context,
new_wsi->ssl = SSL_new(context->ssl_ctx);
if (new_wsi->ssl == NULL) {
lwsl_err("SSL_new failed: %s\n",
ERR_error_string(SSL_get_error(
new_wsi->ssl, 0), NULL));
libwebsockets_decode_ssl_error();
lws_free(new_wsi);
ERR_error_string(SSL_get_error(new_wsi->ssl, 0), NULL));
libwebsockets_decode_ssl_error();
// TODO: Shouldn't the caller handle this?
compatible_close(accept_fd);
break;
goto fail;
}
SSL_set_ex_data(new_wsi->ssl,