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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-01-12T10:00:34+01:00

tm: check on parameters for clonning

---

Modified: src/modules/tm/tm.c

---

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

---

diff --git a/src/modules/tm/tm.c b/src/modules/tm/tm.c
index bfa03010783..0e000f9581e 100644
--- a/src/modules/tm/tm.c
+++ b/src/modules/tm/tm.c
@@ -3405,24 +3405,29 @@ static int w_t_msg_apply_changes(sip_msg_t *msg, char 
*p1, char *p2)
 {
        tm_cell_t *t;
 
+       if(ksr_msg_apply_changes_mode != 1) {
+               return -1;
+       }
+       if(ksr_msg_clone_extra_size <= 0) {
+               return -1;
+       }
+
        if(t_check(msg, 0) == -1)
                return 1;
        t = get_t();
        if(!t || !t->uas.request) {
                return -1;
        }
-       if(ksr_msg_apply_changes_mode == 1) {
-               if(sip_msg_apply_changes(msg) < 0) {
-                       return E_BAD_REQ;
-               }
-               if(parse_headers(msg, HDR_EOH_F, 0)) {
-                       LM_ERR("parse_headers failed\n");
-                       return E_BAD_REQ;
-               }
-               if((msg->parsed_flag & HDR_EOH_F) != HDR_EOH_F) {
-                       LM_ERR("EoH not parsed\n");
-                       return E_UNEXPECTED_STATE;
-               }
+       if(sip_msg_apply_changes(msg) < 0) {
+               return E_BAD_REQ;
+       }
+       if(parse_headers(msg, HDR_EOH_F, 0)) {
+               LM_ERR("parse_headers failed\n");
+               return E_BAD_REQ;
+       }
+       if((msg->parsed_flag & HDR_EOH_F) != HDR_EOH_F) {
+               LM_ERR("EoH not parsed\n");
+               return E_UNEXPECTED_STATE;
        }
        return 1;
 }

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to