From: Andrey Volk Date: Fri, 26 Aug 2022 13:21:01 +0000 (+0300) Subject: [mod_sofia] Unit-test: Fix strcmp null argument. X-Git-Tag: v1.10.8^2~17^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1774%2Fhead;p=thirdparty%2Ffreeswitch.git [mod_sofia] Unit-test: Fix strcmp null argument. --- diff --git a/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c b/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c index 52c7c2f66c..60a7b61a3a 100644 --- a/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c +++ b/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c @@ -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;