1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

sspc: double free + rx ret not checked

Change-Id: I81b67cbb28591a20842fc7d6e09b78375845aae4
This commit is contained in:
Yichen Gu 2020-11-25 18:25:58 +08:00 committed by Andy Green
parent 43f9af2f55
commit 76fd7319be
2 changed files with 12 additions and 7 deletions

View file

@ -523,12 +523,8 @@ lws_sspc_destroy(lws_sspc_handle_t **ph)
if (h->dsh)
lws_dsh_destroy(&h->dsh);
if (h->cwsi) {
struct lws *wsi = h->cwsi;
if (h->cwsi)
h->cwsi = NULL;
if (wsi)
lws_set_timeout(wsi, 1, LWS_TO_KILL_SYNC);
}
/* clean out any pending metadata changes that didn't make it */

View file

@ -693,10 +693,19 @@ payload_ff:
parser);
h->txc.peer_tx_cr_est -= n;
if (client_pss_to_sspc_h(pss, ssi))
if (client_pss_to_sspc_h(pss, ssi)) {
/* we still have an sspc handle */
ssi->rx(client_pss_to_userdata(pss),
int ret = ssi->rx(client_pss_to_userdata(pss),
(uint8_t *)cp, n, flags);
switch (ret) {
case LWSSSSRET_OK:
break;
case LWSSSSRET_DISCONNECT_ME:
goto hangup;
case LWSSSSRET_DESTROY_ME:
return LWSSSSRET_DESTROY_ME;
}
}
#if defined(LWS_WITH_DETAILED_LATENCY)
if (lws_det_lat_active(context)) {