[asterisk-commits] mmichelson: branch group/CCSS r239474 - /team/group/CCSS/channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jan 12 11:13:46 CST 2010
Author: mmichelson
Date: Tue Jan 12 11:13:42 2010
New Revision: 239474
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=239474
Log:
Read entire PIDF body instead of just the first line.
Modified:
team/group/CCSS/channels/chan_sip.c
Modified: team/group/CCSS/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/chan_sip.c?view=diff&rev=239474&r1=239473&r2=239474
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Tue Jan 12 11:13:42 2010
@@ -23735,6 +23735,16 @@
}
#ifdef HAVE_LIBXML2
+static void get_pidf_body(struct sip_request *req, char *pidf_body, size_t size)
+{
+ int i;
+ struct ast_str *str = ast_str_alloca(size);
+ for (i = 0; i < req->lines; ++i) {
+ ast_str_append(&str, 0, "%s", REQ_OFFSET_TO_STR(req, line[i]));
+ }
+ ast_copy_string(pidf_body, ast_str_buffer(str), size);
+}
+
static int pidf_validate_tuple(struct ast_xml_node *tuple_node)
{
const char *id;
@@ -23866,6 +23876,7 @@
int content_length;
const char *content_length_str = get_header(req, "Content-Length");
const char *content_type = get_header(req, "Content-Type");
+ char pidf_body[SIPBUFSIZE];
int res;
if (ast_strlen_zero(content_type) || strcmp(content_type, "application/pidf+xml")) {
@@ -23883,7 +23894,14 @@
return FALSE;
}
- if (!(doc = ast_xml_read_memory(REQ_OFFSET_TO_STR(req, line[0]), content_length))) {
+ if (content_length > sizeof(pidf_body)) {
+ ast_log(LOG_WARNING, "Content length of PIDF document truncated to %d bytes\n", sizeof(pidf_body));
+ content_length = sizeof(pidf_body);
+ }
+
+ get_pidf_body(req, pidf_body, content_length);
+
+ if (!(doc = ast_xml_read_memory(pidf_body, content_length))) {
ast_log(LOG_WARNING, "Unable to open XML PIDF document. Is it malformed?\n");
return FALSE;
}
More information about the asterisk-commits
mailing list