summaryrefslogtreecommitdiff
path: root/channels/sip/include
diff options
context:
space:
mode:
authorDavid M. Lee <dlee@digium.com>2013-01-18 05:31:23 +0000
committerDavid M. Lee <dlee@digium.com>2013-01-18 05:31:23 +0000
commitbe727bf0d217ae086f5df3f1a3e3338be7c71a48 (patch)
tree8396e3281f45a8830b372dc37032938d0b03e8ec /channels/sip/include
parentea78b7cbc8e8806f1d55ba30726a8588391ffb00 (diff)
Fix Record-Route parsing for large headers.
Record-Route parsing copied the header into a char[256] array, which can be a problem if the header is longer than that. This patch parses the header in place, without the copy, avoiding the issue. In addition to the original patch, I added a unit test for the new get_in_brackets_const function. (closes issue ASTERISK-20837) Reported by: Corey Farrell Patches: chan_sip-build_route-optimized-rev1.patch uploaded by Corey Farrell (license 5909) (with minor changes by dlee) ........ Merged revisions 379392 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 379393 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@379394 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/sip/include')
-rw-r--r--channels/sip/include/reqresp_parser.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/channels/sip/include/reqresp_parser.h b/channels/sip/include/reqresp_parser.h
index 9dfec7d39..02b046bc7 100644
--- a/channels/sip/include/reqresp_parser.h
+++ b/channels/sip/include/reqresp_parser.h
@@ -90,6 +90,17 @@ int get_name_and_number(const char *hdr, char **name, char **number);
*/
char *get_in_brackets(char *tmp);
+/*! \brief Get text in brackets on a const without copy
+ *
+ * \param src String to search
+ * \param[out] start Set to first character inside left bracket.
+ * \param[out] length Set to lenght of string inside brackets
+ * \retval 0 success
+ * \retval -1 failure
+ * \retval 1 no brackets so got all
+ */
+int get_in_brackets_const(const char *src,const char **start,int *length);
+
/*! \brief Get text in brackets and any trailing residue
*
* \retval 0 success