From: Anthony Minessale Date: Mon, 9 Jan 2012 19:53:17 +0000 (-0600) Subject: fix some NULL pointer paths X-Git-Tag: v1.2-rc1~19^2~1^2~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=adc82cbe6ef430589bdcfdc26ab4a92d59319893;p=thirdparty%2Ffreeswitch.git fix some NULL pointer paths --- diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index e4947d1b59..ea6724037c 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -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 *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 && (!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 if (zstr(data)) data = body; - if (!check_app_perm(client, app_name)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Permission Denied!\n"); + if (zstr(app_name)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid app\n"); switch_channel_hangup(client->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); return SWITCH_STATUS_FALSE; } - if (zstr(app_name)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid app\n"); + if (!check_app_perm(client, app_name)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Permission Denied!\n"); switch_channel_hangup(client->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); return SWITCH_STATUS_FALSE; - } else { - if (!client->profile->perms.expand_vars) { - const char *p; - - for(p = data; p && *p; p++) { - if (*p == '$') { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Expand Variables: Permission Denied!\n"); - switch_channel_hangup(client->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return SWITCH_STATUS_FALSE; - } + } + + if (!client->profile->perms.expand_vars) { + const char *p; + + for(p = data; p && *p; p++) { + if (*p == '$') { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Expand Variables: Permission Denied!\n"); + 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; }