提交 a09c9cfa authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-10189: [core] switch_core_add_state_handler runtime.state_handler_index may…

FS-10189: [core] switch_core_add_state_handler runtime.state_handler_index may exceed SWITCH_MAX_STATE_HANDLERS  #resolve
上级 a59056a6
...@@ -310,12 +310,13 @@ SWITCH_DECLARE(int) switch_core_add_state_handler(const switch_state_handler_tab ...@@ -310,12 +310,13 @@ SWITCH_DECLARE(int) switch_core_add_state_handler(const switch_state_handler_tab
int index; int index;
switch_mutex_lock(runtime.global_mutex); switch_mutex_lock(runtime.global_mutex);
index = runtime.state_handler_index++; index = runtime.state_handler_index;
if (runtime.state_handler_index >= SWITCH_MAX_STATE_HANDLERS) { if (index > (SWITCH_MAX_STATE_HANDLERS - 1)) {
index = -1; index = -1;
} else { } else {
runtime.state_handlers[index] = state_handler; runtime.state_handlers[index] = state_handler;
runtime.state_handler_index++;
} }
switch_mutex_unlock(runtime.global_mutex); switch_mutex_unlock(runtime.global_mutex);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论