diff --git a/src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp b/src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp index 7bc6fc19f6..f087baf343 100644 --- a/src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp +++ b/src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp @@ -38,7 +38,7 @@ #include #endif -McastHandle::McastHandle(const char *host, int port, int flags) +McastHandle::McastHandle(const char *host, int16_t port, int flags) { mcast_socket_create(host, port, &handle, (mcast_flag_t) flags); } diff --git a/src/mod/endpoints/mod_verto/mcast/mcast_cpp.h b/src/mod/endpoints/mod_verto/mcast/mcast_cpp.h index bc9e85822d..0d289e755a 100644 --- a/src/mod/endpoints/mod_verto/mcast/mcast_cpp.h +++ b/src/mod/endpoints/mod_verto/mcast/mcast_cpp.h @@ -45,7 +45,7 @@ class McastHandle { private: mcast_handle_t handle; public: - McastHandle(const char *host, int port, int flags); + McastHandle(const char *host, int16_t port, int flags); virtual ~McastHandle(); int send(const char *data); char *recv(int ms = 0); diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 612cc16117..6c23a1dcf6 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -104,7 +104,7 @@ static void json_cleanup(void) switch_mutex_lock(json_GLOBALS.store_mutex); top: - for (hi = switch_core_hash_first_iter(json_GLOBALS.store_hash, hi); hi; hi = switch_core_hash_next(&hi)) { + for (hi = switch_core_hash_first_iter(json_GLOBALS.store_hash, hi); hi;) { switch_core_hash_this(hi, &var, NULL, &val); json = (cJSON *) val; cJSON_Delete(json); @@ -315,7 +315,7 @@ static void unsub_all_jsock(void) top: head = NULL; - for (hi = switch_core_hash_first(globals.event_channel_hash); hi; hi = switch_core_hash_next(&hi)) { + for (hi = switch_core_hash_first(globals.event_channel_hash); hi;) { switch_core_hash_this(hi, NULL, NULL, &val); head = (jsock_sub_node_head_t *) val; jsock_unsub_head(NULL, head); @@ -3976,6 +3976,8 @@ static void parse_ip(char *host, uint16_t *port, in_addr_t *addr, char *input) strncpy(host, input, 255); + host[255] = 0; + if ((p = strchr(host, ':')) != NULL) { *p++ = '\0'; *port = (uint16_t)atoi(p); @@ -4983,7 +4985,7 @@ static switch_bool_t json_commit(cJSON *json, const char *name, switch_mutex_t * sql = switch_mprintf("insert into json_store (name,data) values('%q','%q')", name, ascii); - switch_snprintf(del_sql, sizeof(del_sql), "delete from json_store where name='%q'", name); + switch_snprintfv(del_sql, sizeof(del_sql), "delete from json_store where name='%q'", name); dbh = json_get_db_handle(); @@ -5038,7 +5040,7 @@ static switch_status_t json_hanguphook(switch_core_session_t *session) SWITCH_STANDARD_JSON_API(json_store_function) { - cJSON *JSON_STORE, *reply = NULL, *data = cJSON_GetObjectItem(json, "data"); + cJSON *JSON_STORE = NULL, *reply = NULL, *data = cJSON_GetObjectItem(json, "data"); switch_status_t status = SWITCH_STATUS_FALSE; const char *cmd_attr = cJSON_GetObjectCstr(data, "cmd"); const char *uuid = cJSON_GetObjectCstr(data, "uuid"); diff --git a/src/mod/endpoints/mod_verto/ws.c b/src/mod/endpoints/mod_verto/ws.c index 67646175d6..a572a89d07 100644 --- a/src/mod/endpoints/mod_verto/ws.c +++ b/src/mod/endpoints/mod_verto/ws.c @@ -309,7 +309,7 @@ int ws_handshake(wsh_t *wsh) "%s\r\n", b64, proto_buf); - + respond[511] = 0; ws_raw_write(wsh, respond, strlen(respond)); wsh->handshake = 1; @@ -322,6 +322,7 @@ int ws_handshake(wsh_t *wsh) snprintf(respond, sizeof(respond), "HTTP/1.1 400 Bad Request\r\n" "Sec-WebSocket-Version: 13\r\n\r\n"); + respond[511] = 0; ws_raw_write(wsh, respond, strlen(respond));