[sr-dev] git:master:3895cd2e: textops: Fix get_body_part() end of body headers

Stefan Mititelu stefan.mititelu92 at gmail.com
Sat Nov 28 23:08:50 CET 2015


Module: kamailio
Branch: master
Commit: 3895cd2e08c26594a3cff866caea2b431eb71d1e
URL: https://github.com/kamailio/kamailio/commit/3895cd2e08c26594a3cff866caea2b431eb71d1e

Author: Stefan Mititelu <stefan.mititelu92 at gmail.com>
Committer: Stefan Mititelu <stefan.mititelu92 at gmail.com>
Date: 2015-11-28T12:51:29+02:00

textops: Fix get_body_part() end of body headers

Remember the end of body headers and use it for get_body_part().

---

Modified: modules/textops/textops.c

---

Diff:  https://github.com/kamailio/kamailio/commit/3895cd2e08c26594a3cff866caea2b431eb71d1e.diff
Patch: https://github.com/kamailio/kamailio/commit/3895cd2e08c26594a3cff866caea2b431eb71d1e.patch

---

diff --git a/modules/textops/textops.c b/modules/textops/textops.c
index c653c6c..74d7726 100644
--- a/modules/textops/textops.c
+++ b/modules/textops/textops.c
@@ -2031,6 +2031,7 @@ static int remove_multibody_f(struct sip_msg* msg, char* p1)
 static int get_body_part_helper(sip_msg_t* msg, char* ctype, char* ovar, int mode)
 {
 	char *start, *end, *bstart;
+	char *body_headers_end; 
 	unsigned int len, t;
 	str content_type, body;
 	str boundary = {0,0};
@@ -2084,6 +2085,7 @@ static int get_body_part_helper(sip_msg_t* msg, char* ctype, char* ovar, int mod
 				}
 				end = end + 2;
 				len = len - content_type.len - 2;
+				body_headers_end = end;
 				if (find_line_start(boundary.s, boundary.len, &end,
 					&len))
 				{
@@ -2099,12 +2101,8 @@ static int get_body_part_helper(sip_msg_t* msg, char* ctype, char* ovar, int mod
 					pkg_free(boundary.s);
 					boundary.s = NULL;
 					if(mode==1) {
-						end = start;
-						if (!find_line_start(CRLF, CRLF_LEN, &end, &len)) {
-							LM_ERR("no CRLF found after body headers\n");
-							goto err;
-						}
-						val.rs.s = end + CRLF_LEN;
+						end = body_headers_end;
+						val.rs.s = end;
 						val.rs.len = bstart - val.rs.s;
 					} else {
 						val.rs.s = start;




More information about the sr-dev mailing list