From 73b4fc384d1f669ba5679d8eefdb1e83118d5638 Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Fri, 28 Dec 2018 10:59:51 +0100 Subject: [PATCH] Fix WebSocketContext::create sizeof bug --- src/WebSocketContext.h | 7 ++----- uSockets | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/WebSocketContext.h b/src/WebSocketContext.h index ba186e1..ceb419b 100644 --- a/src/WebSocketContext.h +++ b/src/WebSocketContext.h @@ -347,16 +347,13 @@ public: // we do not need SSL options as we come from adoptions static WebSocketContext *create(Loop *loop, SOCKET_CONTEXT_TYPE *parentSocketContext) { - WebSocketContext *webSocketContext; - - // todo: sizeof - webSocketContext = (WebSocketContext *) static_dispatch(us_create_child_ssl_socket_context, us_create_child_socket_context)(parentSocketContext, 100); + WebSocketContext *webSocketContext = (WebSocketContext *)static_dispatch(us_create_child_ssl_socket_context, us_create_child_socket_context)(parentSocketContext, sizeof(WebSocketContextData)); if (!webSocketContext) { return nullptr; } /* Init socket context data */ - new ((WebSocketContextData *) static_dispatch(us_ssl_socket_context_ext, us_socket_context_ext)((SOCKET_CONTEXT_TYPE *) webSocketContext)) WebSocketContextData(); + new ((WebSocketContextData *) static_dispatch(us_ssl_socket_context_ext, us_socket_context_ext)((SOCKET_CONTEXT_TYPE *)webSocketContext)) WebSocketContextData; return webSocketContext->init(); } diff --git a/uSockets b/uSockets index 89fe25b..2e61980 160000 --- a/uSockets +++ b/uSockets @@ -1 +1 @@ -Subproject commit 89fe25b03aa872e38ae3ed3973f4fc86085e93f3 +Subproject commit 2e6198067a8702f51e87e64709b98c0c9ca0fa2f