[asterisk-commits] dvossel: branch 1.8 r324685 - /branches/1.8/channels/sip/reqresp_parser.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jun 23 13:31:04 CDT 2011
Author: dvossel
Date: Thu Jun 23 13:31:00 2011
New Revision: 324685
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=324685
Log:
Fixes sip crash when calling remove_uri_parameters with NULL
AST-2011-009
(closes issue ASTERISK-18017)
Reported by: jaredmauch
Modified:
branches/1.8/channels/sip/reqresp_parser.c
Modified: branches/1.8/channels/sip/reqresp_parser.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/sip/reqresp_parser.c?view=diff&rev=324685&r1=324684&r2=324685
==============================================================================
--- branches/1.8/channels/sip/reqresp_parser.c (original)
+++ branches/1.8/channels/sip/reqresp_parser.c Thu Jun 23 13:31:00 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