[asterisk-commits] dvossel: trunk r324689 - in /trunk: ./ channels/sip/reqresp_parser.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 23 13:31:46 CDT 2011


Author: dvossel
Date: Thu Jun 23 13:31:42 2011
New Revision: 324689

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=324689
Log:
Merged revisions 324685 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r324685 | dvossel | 2011-06-23 13:31:00 -0500 (Thu, 23 Jun 2011) | 8 lines
  
  Fixes sip crash when calling remove_uri_parameters with NULL
  
  AST-2011-009
  
  (closes issue ASTERISK-18017)
  Reported by: jaredmauch
........

Modified:
    trunk/   (props changed)
    trunk/channels/sip/reqresp_parser.c

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

Modified: trunk/channels/sip/reqresp_parser.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sip/reqresp_parser.c?view=diff&rev=324689&r1=324688&r2=324689
==============================================================================
--- trunk/channels/sip/reqresp_parser.c (original)
+++ trunk/channels/sip/reqresp_parser.c Thu Jun 23 13:31:42 2011
@@ -1029,14 +1029,14 @@
 	only affects token based display-names there is no danger of brackets being in quotes */
 	if (first_bracket) {
 		parse = first_bracket;
-		} else {
+	} else {
 		parse = tmp;
 	}
 
 	if ((second_bracket = strchr(parse, '>'))) {
 		*second_bracket++ = '\0';
 		if (out) {
-			*out = first_bracket;
+			*out = (char *) parse;
 		}
 		if (residue) {
 			*residue = second_bracket;
@@ -1045,9 +1045,9 @@
 	}
 
 	if ((first_bracket)) {
-			ast_log(LOG_WARNING, "No closing bracket found in '%s'\n", tmp);
+		ast_log(LOG_WARNING, "No closing bracket found in '%s'\n", tmp);
 		return -1;
-		}
+	}
 
 	if (out) {
 		*out = tmp;
@@ -1076,6 +1076,7 @@
 	char name_no_quotes[] = "name not in quotes <sip:name:secret at host:port;transport=tcp?headers=testblah&headers2=blahblah>";
 	char no_end_bracket[] = "name not in quotes <sip:name:secret at host:port;transport=tcp?headers=testblah&headers2=blahblah";
 	char no_name_no_brackets[] = "sip:name at host";
+	char missing_start_bracket[] = "name not in quotes sip:name:secret at host:port;transport=tcp?headers=testblah&headers2=blahblah>";
 	char *uri = NULL;
 
 	switch (cmd) {
@@ -1137,6 +1138,13 @@
 	if (!(uri = get_in_brackets(no_name_no_brackets)) || (strcmp(uri, "sip:name at host"))) {
 
 		ast_test_status_update(test, "Test 7 failed. %s\n", uri);
+		res = AST_TEST_FAIL;
+	}
+
+	/* Test 8, no start bracket, but with ending bracket. */
+	if (!(uri = get_in_brackets(missing_start_bracket)) || !(strcmp(uri, in_brackets))) {
+
+		ast_test_status_update(test, "Test 8 failed. %s\n", uri);
 		res = AST_TEST_FAIL;
 	}
 




More information about the asterisk-commits mailing list