Module: kamailio Branch: master Commit: 8f7b0b049a03b8dc41ffe407304cfdc81ccb3bb5 URL: https://github.com/kamailio/kamailio/commit/8f7b0b049a03b8dc41ffe407304cfdc81ccb3bb5
Author: SABITHSAHEB <[email protected]> Committer: Daniel-Constantin Mierla <[email protected]> Date: 2026-07-01T09:07:40+02:00 core: fix infinite loop in check_boundaries() when multipart boundary is missing --- Modified: src/core/msg_translator.c --- Diff: https://github.com/kamailio/kamailio/commit/8f7b0b049a03b8dc41ffe407304cfdc81ccb3bb5.diff Patch: https://github.com/kamailio/kamailio/commit/8f7b0b049a03b8dc41ffe407304cfdc81ccb3bb5.patch --- diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c index e62f93c8055..819700c2f3a 100644 --- a/src/core/msg_translator.c +++ b/src/core/msg_translator.c @@ -1942,6 +1942,16 @@ int check_boundaries(struct sip_msg *msg, struct dest_info *send_info) } return -1; } + /* get_boundary() returns success with an empty boundary when the + * Content-Type has parameters but no "boundary=" value. Rewriting with + * an empty boundary would spin forever in the scan loop below, because + * find_line_start() matches a zero-length boundary on every line and + * never advances. Treat it like the no-boundary case and bail out. */ + if(ob.s == NULL || ob.len == 0) { + LM_INFO("no boundary value in Content-Type, skipping multipart " + "rewrite\n"); + return -2; + } buf.s = build_body(msg, (unsigned int *)&buf.len, &ret, send_info); if(ret) { LM_ERR("Can't get body\n"); _______________________________________________ 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!
