[svn-commits] mjordan: branch 11 r426860 - in /branches/11: ./ channels/sip/ channels/sip/i...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Oct 30 22:25:04 CDT 2014


Author: mjordan
Date: Thu Oct 30 22:25:01 2014
New Revision: 426860

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=426860
Log:
channels/sip/reqresp_parser: Fix unit tests for r426594

When r426594 was made, it did not take into account a unit test that verified
that the function properly populated the unsupported buffer. The function
would previously memset the buffer if it detected it had any contents; since
this function can now be called iteratively on successive headers, the unit
tests would now fail. This patch updates the unit tests to reset the buffer
themselves between successive calls, and updates the documentation of the
function to note that this is now required.
........

Merged revisions 426858 from http://svn.asterisk.org/svn/asterisk/branches/1.8

Modified:
    branches/11/   (props changed)
    branches/11/channels/sip/include/reqresp_parser.h
    branches/11/channels/sip/reqresp_parser.c

Propchange: branches/11/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: branches/11/channels/sip/include/reqresp_parser.h
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/sip/include/reqresp_parser.h?view=diff&rev=426860&r1=426859&r2=426860
==============================================================================
--- branches/11/channels/sip/include/reqresp_parser.h (original)
+++ branches/11/channels/sip/include/reqresp_parser.h Thu Oct 30 22:25:01 2014
@@ -152,6 +152,11 @@
  * \param option list
  * \param unsupported out buffer (optional)
  * \param unsupported out buffer length (optional)
+ *
+ * \note Because this function can be called multiple times, it will append
+ * whatever options are specified in \c options to \c unsupported. Callers
+ * of this function should make sure the unsupported buffer is clear before
+ * calling this function.
  */
 unsigned int parse_sip_options(const char *options, char *unsupported, size_t unsupported_len);
 

Modified: branches/11/channels/sip/reqresp_parser.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/sip/reqresp_parser.c?view=diff&rev=426860&r1=426859&r2=426860
==============================================================================
--- branches/11/channels/sip/reqresp_parser.c (original)
+++ branches/11/channels/sip/reqresp_parser.c Thu Oct 30 22:25:01 2014
@@ -1601,7 +1601,6 @@
 	temp = ast_strdupa(options);
 
 	ast_debug(3, "Begin: parsing SIP \"Supported: %s\"\n", options);
-
 	for (next = temp; next; next = sep) {
 		found = FALSE;
 		supported = FALSE;
@@ -1761,6 +1760,7 @@
 
 	/* Test with unsupported char buffer */
 	AST_LIST_TRAVERSE(&testdatalist, testdataptr, list) {
+		memset(unsupported, 0, sizeof(unsupported));
 		option_profile = parse_sip_options(testdataptr->input_options, unsupported, ARRAY_LEN(unsupported));
 		if (option_profile != testdataptr->expected_profile ||
 			strcmp(unsupported, testdataptr->expected_unsupported)) {




More information about the svn-commits mailing list