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

fix some NULL pointer paths

上级 9e860b94
...@@ -273,6 +273,11 @@ static switch_status_t parse_get_var(const char *tag_name, client_t *client, swi ...@@ -273,6 +273,11 @@ static switch_status_t parse_get_var(const char *tag_name, client_t *client, swi
const char *var = switch_xml_attr(tag, "name"); const char *var = switch_xml_attr(tag, "name");
const char *perm = switch_xml_attr(tag, "permanent"); const char *perm = switch_xml_attr(tag, "permanent");
if (zstr(var)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing name attribute!");
return SWITCH_STATUS_SUCCESS;
}
if (client->profile->perms.get_vars && if (client->profile->perms.get_vars &&
(!client->profile->var_params.get_var_list || switch_event_check_permission_list(client->profile->var_params.get_var_list, var))) { (!client->profile->var_params.get_var_list || switch_event_check_permission_list(client->profile->var_params.get_var_list, var))) {
...@@ -692,32 +697,32 @@ static switch_status_t parse_execute(const char *tag_name, client_t *client, swi ...@@ -692,32 +697,32 @@ static switch_status_t parse_execute(const char *tag_name, client_t *client, swi
if (zstr(data)) data = body; if (zstr(data)) data = body;
if (!check_app_perm(client, app_name)) { if (zstr(app_name)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Permission Denied!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid app\n");
switch_channel_hangup(client->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); switch_channel_hangup(client->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
if (zstr(app_name)) { if (!check_app_perm(client, app_name)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid app\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Permission Denied!\n");
switch_channel_hangup(client->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); switch_channel_hangup(client->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} else { }
if (!client->profile->perms.expand_vars) {
const char *p; if (!client->profile->perms.expand_vars) {
const char *p;
for(p = data; p && *p; p++) {
if (*p == '$') { for(p = data; p && *p; p++) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Expand Variables: Permission Denied!\n"); if (*p == '$') {
switch_channel_hangup(client->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Expand Variables: Permission Denied!\n");
return SWITCH_STATUS_FALSE; switch_channel_hangup(client->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
} return SWITCH_STATUS_FALSE;
} }
} }
switch_core_session_execute_application(client->session, app_name, data);
} }
switch_core_session_execute_application(client->session, app_name, data);
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论