From b41d779b6d8b30f311a490d76f211c1ca656ce38 Mon Sep 17 00:00:00 2001 From: Walter Doekes Date: Mon, 12 Jan 2015 12:05:52 +0100 Subject: [PATCH] websocket: Check frame->wsc in ws_frame_transmit for NULL. Add frame.wsc == NULL check in ws_frame_transmit similar to the checks in ws_close and friends and ws_frame_receive to avoid crashing if the tcp connection was been terminated prematurely. (cherry picked from commit c109755d347500d8dcfa92a75cb11c9cea2727c2) --- modules/websocket/ws_frame.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/websocket/ws_frame.c b/modules/websocket/ws_frame.c index d3814bd5cb4..a6b4f901e11 100644 --- a/modules/websocket/ws_frame.c +++ b/modules/websocket/ws_frame.c @@ -743,6 +743,11 @@ int ws_frame_transmit(void *data) frame.payload_len = wsev->len; frame.payload_data = wsev->buf; frame.wsc = wsconn_get(wsev->id); + if (frame.wsc == NULL) + { + LM_ERR("WebSocket outbound connection not found\n"); + return -1; + } LM_DBG("Tx message:\n%.*s\n", frame.payload_len, frame.payload_data);