From dc30013360d28bcdb73a287f4420dcc13dd4ea1c Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 8 Jun 2012 16:09:26 +0000 Subject: [PATCH] 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 --- src/mod/endpoints/mod_sofia/sofia_glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 3a215c3529..9bc9ae02ff 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -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....*/