fix buffer length calculation in call to generate_m

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
This commit is contained in:
Travis Cross 2012-06-08 16:09:26 +00:00
parent 9c463fdbdc
commit dc30013360
1 changed files with 1 additions and 1 deletions

View 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....*/