diff options
-rw-r--r-- | channels/chan_sip.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index a2a9217be..925abb1d9 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -6615,8 +6615,9 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action int text = FALSE; numberofports = 1; - if ((sscanf(m, "audio %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2) || - (sscanf(m, "audio %d RTP/AVP %n", &x, &len) == 1)) { + len = -1; + if ((sscanf(m, "audio %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) || + (sscanf(m, "audio %d RTP/AVP %n", &x, &len) == 1 && len > 0)) { audio = TRUE; numberofmediastreams++; /* Found audio stream in this media definition */ @@ -6631,8 +6632,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action ast_verbose("Found RTP audio format %d\n", codec); ast_rtp_set_m_type(newaudiortp, codec); } - } else if ((sscanf(m, "video %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2) || - (sscanf(m, "video %d RTP/AVP %n", &x, &len) == 1)) { + } else if ((sscanf(m, "video %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) || + (sscanf(m, "video %d RTP/AVP %n", &x, &len) == 1 && len >= 0)) { video = TRUE; p->novideo = FALSE; numberofmediastreams++; @@ -6647,8 +6648,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action ast_verbose("Found RTP video format %d\n", codec); ast_rtp_set_m_type(newvideortp, codec); } - } else if ((sscanf(m, "text %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2) || - (sscanf(m, "text %d RTP/AVP %n", &x, &len) == 1)) { + } else if ((sscanf(m, "text %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) || + (sscanf(m, "text %d RTP/AVP %n", &x, &len) == 1 && len > 0)) { text = TRUE; p->notext = FALSE; numberofmediastreams++; @@ -6663,8 +6664,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action ast_verbose("Found RTP text format %d\n", codec); ast_rtp_set_m_type(newtextrtp, codec); } - } else if (p->udptl && ( (sscanf(m, "image %d udptl t38%n", &x, &len) == 1) || - (sscanf(m, "image %d UDPTL t38%n", &x, &len) == 1) )) { + } else if (p->udptl && ( (sscanf(m, "image %d udptl t38%n", &x, &len) == 1 && len > 0) || + (sscanf(m, "image %d UDPTL t38%n", &x, &len) == 1 && len > 0) )) { if (debug) ast_verbose("Got T.38 offer in SDP in dialog %s\n", p->callid); udptlportno = x; |