]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_sofia] Unit-test: Fix strcmp null argument. 1774/head
authorAndrey Volk <andywolk@gmail.com>
Fri, 26 Aug 2022 13:21:01 +0000 (16:21 +0300)
committerAndrey Volk <andywolk@gmail.com>
Fri, 26 Aug 2022 13:21:01 +0000 (16:21 +0300)
src/mod/endpoints/mod_sofia/test/sipp-based-tests.c

index 52c7c2f66cb50b65fc7d87e9d3bdbca35aab6391..60a7b61a3aa8dda3ff4a3df996d864e8f851f5c3 100644 (file)
@@ -48,7 +48,7 @@ static void test_wait_for_uuid(char *uuid)
                SWITCH_STANDARD_STREAM(stream);
                switch_api_execute("show", "channels", NULL, &stream);
 
-               if (!strncmp((char *)stream.data, "uuid,", 5)) {
+               if (stream.data && !strncmp((char *)stream.data, "uuid,", 5)) {
                        channel_data = switch_mprintf("%s", (char *)stream.data);
                        switch_safe_free(stream.data);
                        break;
@@ -76,7 +76,9 @@ static const char *test_wait_for_chan_var(switch_channel_t *channel, const char
        int loop_count = 50;
        const char *var=NULL;
        do {
-               if (!strcmp(switch_channel_get_variable(channel, "sip_cseq"),seq)){
+               const char *sip_cseq = switch_channel_get_variable(channel, "sip_cseq");
+
+               if (sip_cseq && seq && !strcmp(sip_cseq, seq)){
                        switch_sleep(100 * 1000);
                        var = switch_channel_get_variable(channel, "rtp_local_sdp_str");
                        break;