فهرست منبع

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)
Walter Doekes 10 سال پیش
والد
کامیت
b41d779b6d
1فایلهای تغییر یافته به همراه5 افزوده شده و 0 حذف شده
  1. 5 0
      modules/websocket/ws_frame.c

+ 5 - 0
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);