From f803c0d9df4aa7a686cc330ca36f07c1aa97c5dd Mon Sep 17 00:00:00 2001 From: Nick Dowell Date: Thu, 5 Apr 2012 10:29:29 +0800 Subject: [PATCH] fix heap corruption if HTTP callback calls libwebsocket_close_and_free_session Signed-off-by: Nick Dowell --- lib/handshake.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/handshake.c b/lib/handshake.c index dca2e14..6809be4 100644 --- a/lib/handshake.c +++ b/lib/handshake.c @@ -596,11 +596,11 @@ libwebsocket_read(struct libwebsocket_context *context, struct libwebsocket *wsi if (!wsi->utf8_token[WSI_TOKEN_UPGRADE].token_len || !wsi->utf8_token[WSI_TOKEN_CONNECTION].token_len) { + wsi->state = WSI_STATE_HTTP; if (wsi->protocol->callback) (wsi->protocol->callback)(context, wsi, LWS_CALLBACK_HTTP, wsi->user_space, wsi->utf8_token[WSI_TOKEN_GET_URI].token, 0); - wsi->state = WSI_STATE_HTTP; return 0; } -- 2.7.4