Explorar o código

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
Daniel-Constantin Mierla %!s(int64=11) %!d(string=hai) anos
pai
achega
19e8a5618f
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      modules/websocket/ws_conn.c

+ 2 - 1
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;