summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2016-12-12 20:41:05 +0800
committerAndy Green <andy@warmcat.com>2016-12-12 20:41:05 +0800
commit31d2a2c6ddccf4b657eadbcdeef56c8b3bdfd592 (patch)
tree021ef0c671c7faa9907e85fd567469caa5de1ba4
parent386365d4bb1c20a29982b8a6e008daacea95d718 (diff)
downloadlibwebsockets-31d2a2c6ddccf4b657eadbcdeef56c8b3bdfd592.tar.gz
libwebsockets-31d2a2c6ddccf4b657eadbcdeef56c8b3bdfd592.tar.bz2
libwebsockets-31d2a2c6ddccf4b657eadbcdeef56c8b3bdfd592.zip
client: avoid possible NULL deref on error pathupstream/1.7.9upstream_210817
https://github.com/warmcat/libwebsockets/issues/672
-rw-r--r--lib/client-handshake.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/client-handshake.c b/lib/client-handshake.c
index f78f4f19..904f6ecd 100644
--- a/lib/client-handshake.c
+++ b/lib/client-handshake.c
@@ -311,8 +311,11 @@ lws_client_connect_2(struct lws *wsi)
oom4:
/* we're closing, losing some rx is OK */
- wsi->u.hdr.ah->rxpos = wsi->u.hdr.ah->rxlen;
+ if (wsi->u.hdr.ah)
+ wsi->u.hdr.ah->rxpos = wsi->u.hdr.ah->rxlen;
+
lws_header_table_detach(wsi);
+
/* take care that we might be inserted in fds already */
if (wsi->position_in_fds_table != -1)
goto failed;