Module: sip-router
Branch: master
Commit: 19e8a5618f86833995d17200267910e44471141d
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=19e8a56…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Oct 16 00:57:29 2014 +0200
websocket: safety guard when computing the list of connections
- avoid going further if connection is null -- unlikely to happen as len
of the list is computed before
---
modules/websocket/ws_conn.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/modules/websocket/ws_conn.c b/modules/websocket/ws_conn.c
index 88fe5e8..06f7b13 100644
--- a/modules/websocket/ws_conn.c
+++ b/modules/websocket/ws_conn.c
@@ -486,6 +486,7 @@ ws_connection_t **wsconn_get_list(void)
{
if (!wsc) {
LM_ERR("Wrong list length\n");
+ break;
}
list[i] = wsc;
@@ -494,7 +495,7 @@ ws_connection_t **wsconn_get_list(void)
wsc = wsc->used_next;
}
- list[list_len] = NULL; /* explicit NULL termination */
+ list[i] = NULL; /* explicit NULL termination */
end:
WSCONN_UNLOCK;