[asterisk-commits] mmichelson: trunk r397962 - in /trunk: ./ res/res_pjsip_pidf.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 29 17:54:07 CDT 2013


Author: mmichelson
Date: Thu Aug 29 17:54:05 2013
New Revision: 397962

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397962
Log:
Fix method for creating activities string in PIDF bodies.

The previous method did not allocate enough space to create
the entire string, but adjusted the string's slen value to
be larger than the actual allocation. This resulted in garbled
text in NOTIFY requests from Asterisk.

This method allocates the proper amount of space first and then
writes the content into the buffer.
........

Merged revisions 397960 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/res/res_pjsip_pidf.c

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Thu Aug 29 17:54:05 2013
@@ -1,1 +1,1 @@
-/branches/12:1-397927,397938,397945-397946,397955,397958
+/branches/12:1-397927,397938,397945-397946,397955,397958,397960

Modified: trunk/res/res_pjsip_pidf.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip_pidf.c?view=diff&rev=397962&r1=397961&r2=397962
==============================================================================
--- trunk/res/res_pjsip_pidf.c (original)
+++ trunk/res/res_pjsip_pidf.c Thu Aug 29 17:54:05 2013
@@ -159,8 +159,11 @@
 
 	if (pidfstate[0] != '-') {
 		pj_xml_node *activities = create_node(pool, status, "ep:activities");
-		pj_strdup2(pool, &activities->content, "ep:");
-		pj_strcat2(&activities->content, pidfstate);
+		size_t str_size = sizeof("ep:") + strlen(pidfstate);
+
+		activities->content.ptr = pj_pool_alloc(pool, str_size);
+		activities->content.slen = pj_ansi_snprintf(activities->content.ptr, str_size,
+				"ep:%s", pidfstate);
 	}
 
 	create_attr(pool, node, XMLNS_PP, XMLNS_PERSON);




More information about the asterisk-commits mailing list