From 3895cd2e08c26594a3cff866caea2b431eb71d1e Mon Sep 17 00:00:00 2001 From: Stefan Mititelu Date: Sat, 28 Nov 2015 12:51:29 +0200 Subject: [PATCH] textops: Fix get_body_part() end of body headers Remember the end of body headers and use it for get_body_part(). --- modules/textops/textops.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/textops/textops.c b/modules/textops/textops.c index c653c6c003c..74d7726b450 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;