Module: kamailio
Branch: 4.2
Commit: b41d779b6d8b30f311a490d76f211c1ca656ce38
URL: 
https://github.com/kamailio/kamailio/commit/b41d779b6d8b30f311a490d76f211c1ca656ce38

Author: Walter Doekes <walter+git...@wjd.nu>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2015-01-15T20:13:01+01:00

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)

---

Modified: modules/websocket/ws_frame.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/b41d779b6d8b30f311a490d76f211c1ca656ce38.diff
Patch: 
https://github.com/kamailio/kamailio/commit/b41d779b6d8b30f311a490d76f211c1ca656ce38.patch

---

diff --git a/modules/websocket/ws_frame.c b/modules/websocket/ws_frame.c
index d3814bd..a6b4f90 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);


_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to