client: protect against possible NULL deref path 03/108803/1 tizen_3.0
authorAndy Green <andy@warmcat.com>
Wed, 4 Jan 2017 06:38:39 +0000 (14:38 +0800)
committerGihun Chang <gihun.chang@samsung.com>
Thu, 5 Jan 2017 23:42:12 +0000 (08:42 +0900)
Change-Id: I1a2e3f05bc3b79e65bd32e9ba3fa0603a22f47c7

lib/libwebsockets.c

index 5ab49a1293655909409187bd1fe75182c3e6d455..dc4aa5f4c231ace2dcbed7c1213b376666cb8fa2 100755 (executable)
@@ -408,7 +408,9 @@ just_kill_connection:
                char* errorString;
 
                lwsl_debug("Connection closed before server reply\n");
-               errorString = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP);
+               errorString = NULL;
+               if (wsi->u.hdr.ah)
+                       errorString = lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP);
                if (errorString) {
                        context->protocols[0].callback(wsi,
                                        LWS_CALLBACK_CLIENT_CONNECTION_ERROR,