ssl fix excessive crash workaround
authorAndy Green <andy.green@linaro.org>
Sun, 10 Aug 2014 01:50:42 +0000 (09:50 +0800)
committerAndy Green <andy.green@linaro.org>
Sun, 10 Aug 2014 01:50:42 +0000 (09:50 +0800)
Signed-off-by: Andy Green <andy.green@linaro.org>
lib/server.c
lib/ssl.c

index d6a65cf..aad5286 100644 (file)
@@ -731,10 +731,9 @@ int lws_server_socket_service(struct libwebsocket_context *context,
                break;
        }
 
-       if (new_wsi)
-               if (lws_server_socket_service_ssl(context, &wsi, new_wsi,
-                                                 accept_fd, pollfd))
-                       goto fail;
+       if (lws_server_socket_service_ssl(context, &wsi, new_wsi,
+                                                         accept_fd, pollfd))
+               goto fail;
 
        return 0;
        
index 7bebacf..520fbef 100644 (file)
--- a/lib/ssl.c
+++ b/lib/ssl.c
@@ -445,6 +445,11 @@ lws_server_socket_service_ssl(struct libwebsocket_context *context,
        switch (wsi->mode) {
        case LWS_CONNMODE_SERVER_LISTENER:
 
+               if (!new_wsi) {
+                       lwsl_err("no new_wsi\n");
+                       return 0;
+               }
+
                new_wsi->ssl = SSL_new(context->ssl_ctx);
                if (new_wsi->ssl == NULL) {
                        lwsl_err("SSL_new failed: %s\n",