Module: kamailio
Branch: 4.4
Commit: 65cb4a63c572260bcdc96a84a421c66cf3086dcb
URL: 
https://github.com/kamailio/kamailio/commit/65cb4a63c572260bcdc96a84a421c66cf3086dcb

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2016-10-10T12:13:15+02:00

core: rely on msg->last_header to get the anchor inside sr_hdr_add()

- might fix GH #789

(cherry picked from commit 9483b5491f82dd18bbdaeee72fd43ec6e1fbfb8c)

---

Modified: data_lump.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/65cb4a63c572260bcdc96a84a421c66cf3086dcb.diff
Patch: 
https://github.com/kamailio/kamailio/commit/65cb4a63c572260bcdc96a84a421c66cf3086dcb.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");


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to