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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-07-10T16:45:27+02:00

core: allow single CR in multipart body

- GH #4817

---

Modified: src/core/msg_translator.c

---

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

---

diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c
index 1d79b8887b7..d9fa3f06b51 100644
--- a/src/core/msg_translator.c
+++ b/src/core/msg_translator.c
@@ -1774,6 +1774,10 @@ static inline int adjust_clen(struct sip_msg *msg, int 
body_delta, int proto)
        return -1;
 }
 
+/**
+ * find the line that starts with text
+ * - update *buf to the start of the line and adjust *buf_len
+ */
 static inline int find_line_start(
                char *text, unsigned int text_len, char **buf, unsigned int 
*buf_len)
 {
@@ -1791,8 +1795,10 @@ static inline int find_line_start(
                }
                if((ch = memchr(start, 13, len - 1))) {
                        if(*(ch + 1) != 10) {
-                               LM_ERR("No LF after CR\n");
-                               return 0;
+                               /* allow single CR (0x0D) byte inside a body 
part */
+                               len = len - (ch - start + 1);
+                               start = ch + 1;
+                               continue;
                        }
                        len = len - (ch - start + 2);
                        start = ch + 2;

_______________________________________________
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