]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix some NULL pointer paths
authorAnthony Minessale <anthm@freeswitch.org>
Mon, 9 Jan 2012 19:53:17 +0000 (13:53 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Mon, 9 Jan 2012 19:53:17 +0000 (13:53 -0600)
src/mod/applications/mod_httapi/mod_httapi.c

index e4947d1b59e89ea8f52a89f4e13c8dc2c596c411..ea6724037c80890d57bad6561c5623d879c77d4f 100644 (file)
@@ -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;
 }