]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix possible bad pointer in global vars (please test)
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 2 Feb 2011 22:05:51 +0000 (16:05 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 2 Feb 2011 22:05:51 +0000 (16:05 -0600)
libs/freetdm/mod_freetdm/mod_freetdm.c
libs/openzap/mod_openzap/mod_openzap.c

index 970cb5b993a098cd991d6920c590bbdf09e32f3a..2ef21cc1865254c59c2aad36d92e43dd2c172c93 100755 (executable)
@@ -1067,9 +1067,16 @@ static const char* channel_get_variable(switch_core_session_t *session, switch_e
                        return variable;
                }
        }
+
+
+          // This is unsafe, I don't see anywhere in the whole code where this is called with NULL session anyway.
+          // There is a new switch_core_get_variable_dup that will strdup it for you and then you must free it.
+          // That messes up the abstraction completely so I am just commenting it out for you.....
+          /*
        if ((variable = switch_core_get_variable(variable_name))) {
                return variable;
        }
+          */
        return NULL;
 }
 
index d52149c65714255ca1ce7b19e86ddea0f37957f1..ef346b8eea585c03244000be5edcafec8bc05809 100644 (file)
@@ -1234,19 +1234,19 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                zap_set_string(caller_data.ani.digits, dest);
        }
        
-       if ((var = switch_event_get_header(var_event, "openzap_outbound_ton")) || (var = switch_core_get_variable("openzap_outbound_ton"))) {
+       if ((var = switch_event_get_header(var_event, "openzap_outbound_ton"))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting TON to: %s\n", var);
                zap_set_ton(var, &caller_data.ani.type);
        } else {
                caller_data.ani.type = outbound_profile->destination_number_ton;
        }
 
-       if ((var = switch_event_get_header(var_event, "openzap_custom_call_data")) || (var = switch_core_get_variable("openzap_custom_call_data"))) {
+       if ((var = switch_event_get_header(var_event, "openzap_custom_call_data"))) {
                zap_set_string((char *)caller_data.raw_data, var);
                caller_data.raw_data_len = strlen(var);
        }
        
-       if ((var = switch_event_get_header(var_event, "openzap_outbound_npi")) || (var = switch_core_get_variable("openzap_outbound_npi"))) {
+       if ((var = switch_event_get_header(var_event, "openzap_outbound_npi"))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting NPI to: %s\n", var);
                zap_set_npi(var, &caller_data.ani.plan);
        } else {