aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-08-19 17:11:17 -0700
committerGarrett D'Amore <garrett@damore.org>2018-08-19 17:13:01 -0700
commit82dce653c6fdbd7170bfe1c17c7a7f50b6e05732 (patch)
treeb21f233f30f0a2232d7e8a0ca311105f80ac4adc
parent8a57f51bc717f816840f9168e8558e9e80bbea8a (diff)
downloadnng-82dce653c6fdbd7170bfe1c17c7a7f50b6e05732.tar.gz
nng-82dce653c6fdbd7170bfe1c17c7a7f50b6e05732.tar.bz2
nng-82dce653c6fdbd7170bfe1c17c7a7f50b6e05732.zip
fixes #638 Race condition detected in websocket
fixes #651 Use after free in websocket
-rw-r--r--src/supplemental/websocket/websocket.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/supplemental/websocket/websocket.c b/src/supplemental/websocket/websocket.c
index 05eab36b..efa0fdf8 100644
--- a/src/supplemental/websocket/websocket.c
+++ b/src/supplemental/websocket/websocket.c
@@ -441,6 +441,7 @@ ws_close_cb(void *arg)
}
ws_msg_fini(wm);
}
+ ws->txframe = NULL;
if (ws->rxframe != NULL) {
ws_frame_fini(ws->rxframe);
@@ -1263,10 +1264,10 @@ ws_http_cb_dialer(nni_ws *ws, nni_aio *aio)
char wskey[29];
const char * ptr;
- d = ws->dialer;
+ d = ws->dialer;
+ nni_mtx_lock(&d->mtx);
uaio = ws->useraio;
- nni_mtx_lock(&d->mtx);
// We have two steps. In step 1, we just sent the request,
// and need to retrieve the reply. In step two we have
// received the reply, and need to validate it.