From eefcaa762ef1121315102329b206276244045926 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Wed, 4 Jan 2017 14:38:05 +0800 Subject: [PATCH] client: protect against possible NULL deref path --- lib/libwebsockets.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index dbc70920..06704b2b 100755 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -499,7 +499,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) { wsi->vhost->protocols[0].callback(wsi, LWS_CALLBACK_CLIENT_CONNECTION_ERROR,