Module: kamailio
Branch: 5.8
Commit: 8035009ec6d34528562969808e71204860f58ac5
URL: 
https://github.com/kamailio/kamailio/commit/8035009ec6d34528562969808e71204860f58ac5

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-01-05T09:32:43+01:00

tm: safety check for EoL in user-agent parameter

(cherry picked from commit 7eea4bc836bd14c7341d77e8cdde8a473ce2eef2)
(cherry picked from commit 3bc7431d77c5795f58e475087976ee9e3f7d563e)

---

Modified: src/modules/tm/t_msgbuilder.c

---

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

---

diff --git a/src/modules/tm/t_msgbuilder.c b/src/modules/tm/t_msgbuilder.c
index 1fec2aa37f2..a1e93f44b32 100644
--- a/src/modules/tm/t_msgbuilder.c
+++ b/src/modules/tm/t_msgbuilder.c
@@ -1710,7 +1710,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