[sr-dev] git:master:9483b549: core: rely on msg->last_header to get the anchor inside sr_hdr_add()
Daniel-Constantin Mierla
miconda at gmail.com
Tue Sep 20 11:41:45 CEST 2016
Module: kamailio
Branch: master
Commit: 9483b5491f82dd18bbdaeee72fd43ec6e1fbfb8c
URL: https://github.com/kamailio/kamailio/commit/9483b5491f82dd18bbdaeee72fd43ec6e1fbfb8c
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-09-20T11:40:07+02:00
core: rely on msg->last_header to get the anchor inside sr_hdr_add()
- might fix GH #789
---
Modified: data_lump.c
---
Diff: https://github.com/kamailio/kamailio/commit/9483b5491f82dd18bbdaeee72fd43ec6e1fbfb8c.diff
Patch: https://github.com/kamailio/kamailio/commit/9483b5491f82dd18bbdaeee72fd43ec6e1fbfb8c.patch
---
diff --git a/data_lump.c b/data_lump.c
index 5d085ec..5b87b8e 100644
--- a/data_lump.c
+++ b/data_lump.c
@@ -743,13 +743,19 @@ int sr_hdr_add(sip_msg_t *msg, str *sname, str *sbody)
struct lump* anchor;
str h;
+ parse_headers(msg, HDR_EOH_F, 0);
+ if(msg->last_header == 0) {
+ LM_ERR("failed to parse headers\n");
+ return -1;
+ }
h.len = sname->len + 2 + sbody->len + CRLF_LEN;
h.s = (char*)pkg_malloc(h.len+1);
if(h.s == 0) {
LM_ERR("no more pkg\n");
return -1;
}
- anchor = anchor_lump(msg, msg->unparsed - msg->buf, 0, 0);
+ anchor = anchor_lump(msg, msg->last_header->name.s + msg->last_header->len
+ - msg->buf, 0, 0);
if(anchor == 0)
{
LM_ERR("cannot get the anchor\n");
More information about the sr-dev
mailing list