From 9f5c2a1619864ad13a791dd3fa6c59016e94c5d1 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 26 Aug 2022 16:21:01 +0300 Subject: [PATCH] [mod_sofia] Unit-test: Fix strcmp null argument. --- src/mod/endpoints/mod_sofia/test/sipp-based-tests.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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;