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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2025-12-22T12:08:57+01:00

tm: safety check for EoL in user-agent parameter

---

Modified: src/modules/tm/t_msgbuilder.c

---

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

---

diff --git a/src/modules/tm/t_msgbuilder.c b/src/modules/tm/t_msgbuilder.c
index b8fa2f968c6..e497c0cbf16 100644
--- a/src/modules/tm/t_msgbuilder.c
+++ b/src/modules/tm/t_msgbuilder.c
@@ -1788,7 +1788,9 @@ char *build_uac_req(str *method, str *headers, str *body, 
dlg_t *dialog,
        /* Server signature */
        if(server_signature && user_agent_hdr.len > 0) {
                memapp(w, user_agent_hdr.s, user_agent_hdr.len);
-               memapp(w, CRLF, CRLF_LEN);
+               if(user_agent_hdr.s[user_agent_hdr.len - 1] != '\n') {
+                       memapp(w, CRLF, CRLF_LEN);
+               }
        }
        if(headers && headers->len > 2) {
                memapp(w, headers->s, headers->len);

_______________________________________________
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