[sr-dev] git:5.4:49f3ec66: core: parse main headers after updating msg buffer

Daniel-Constantin Mierla miconda at gmail.com
Mon Dec 6 14:35:55 CET 2021


Module: kamailio
Branch: 5.4
Commit: 49f3ec66c9e187584f403ca19e3b436abd20376a
URL: https://github.com/kamailio/kamailio/commit/49f3ec66c9e187584f403ca19e3b436abd20376a

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-12-06T14:29:42+01:00

core: parse main headers after updating msg buffer

- same group of headers as for the case of receiving the message
- applies for msg_apply_changes() as well
- related to GH #2877

(cherry picked from commit d5c1b4693b6e47b4123b5f9417b5fd88d4dafd1f)
(cherry picked from commit 992c5a349454e40c87c8918283ffde7302da9d8e)

---

Modified: src/core/msg_translator.c

---

Diff:  https://github.com/kamailio/kamailio/commit/49f3ec66c9e187584f403ca19e3b436abd20376a.diff
Patch: https://github.com/kamailio/kamailio/commit/49f3ec66c9e187584f403ca19e3b436abd20376a.patch

---

diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c
index 1ecb566592..683b4a3b00 100644
--- a/src/core/msg_translator.c
+++ b/src/core/msg_translator.c
@@ -3315,7 +3315,13 @@ int sip_msg_update_buffer(sip_msg_t *msg, str *obuf)
 		 * valid/safe for config */
 		return 0;
 	}
-
+	if(parse_headers(msg, HDR_FROM_F|HDR_TO_F|HDR_CALLID_F|HDR_CSEQ_F, 0) < 0) {
+		LM_ERR("parsing main headers of new sip message failed [[%.*s]]\n",
+				msg->len, msg->buf);
+		/* exit config execution - sip_msg_t structure is no longer
+		 * valid/safe for config */
+		return 0;
+	}
 	return 1;
 }
 




More information about the sr-dev mailing list