]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix buffer length calculation in call to generate_m
authorTravis Cross <tc@traviscross.com>
Fri, 8 Jun 2012 16:09:26 +0000 (16:09 +0000)
committerTravis Cross <tc@traviscross.com>
Fri, 8 Jun 2012 16:14:20 +0000 (16:14 +0000)
This error was causing us to call generate_m with a buffer length that
was less than the strlen of the buffer we were passing.  The result
was truncated local SDP which would cause sofia to fail if the
truncation was in a particularly bad place.

Thanks to Anthony Minessale for the fix and working with me to
diagnose the issue.

FS-4293 --resolve

src/mod/endpoints/mod_sofia/sofia_glue.c

index 3a215c35296b59f6c2cbcd32313283690bc7f763..9bc9ae02ff131ba1255c0bae8f7801af7228a825 100644 (file)
@@ -621,7 +621,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch
                                        cur_ptime = this_ptime;                 
                                        
                                        if ((!zstr(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE))) {
-                                               generate_m(tech_pvt, buf, sizeof(buf), port, cur_ptime, append_audio, sr, use_cng, cng_type, map, verbose_sdp, 1);
+                                               generate_m(tech_pvt, bp, sizeof(buf) - strlen(buf), port, cur_ptime, append_audio, sr, use_cng, cng_type, map, verbose_sdp, 1);
                                                bp = (buf + strlen(buf));
 
                                                /* asterisk can't handle AVP and SAVP in sep streams, way to blow off the spec....*/