Module: kamailio Branch: master Commit: 02b74b4c752ba6ee89e262f41727d2830905b5f8 URL: https://github.com/kamailio/kamailio/commit/02b74b4c752ba6ee89e262f41727d2830905b5f8
Author: Daniel-Constantin Mierla <[email protected]> Committer: Daniel-Constantin Mierla <[email protected]> Date: 2026-05-10T14:41:59+02:00 textops: check content type for appending multibody --- Modified: src/modules/textops/textops.c --- Diff: https://github.com/kamailio/kamailio/commit/02b74b4c752ba6ee89e262f41727d2830905b5f8.diff Patch: https://github.com/kamailio/kamailio/commit/02b74b4c752ba6ee89e262f41727d2830905b5f8.patch --- diff --git a/src/modules/textops/textops.c b/src/modules/textops/textops.c index 2d879c5fa60..b5c715101ab 100644 --- a/src/modules/textops/textops.c +++ b/src/modules/textops/textops.c @@ -3179,6 +3179,7 @@ int ki_append_multibody_cd(sip_msg_t *msg, str *txt, str *ct, str *cd) { struct lump *l; int off; + int mime; str body = {0, 0}; str *nbb = NULL; str delimiter = {0, 0}; @@ -3204,9 +3205,23 @@ int ki_append_multibody_cd(sip_msg_t *msg, str *txt, str *ct, str *cd) return -1; } + mime = parse_content_type_hdr(msg); + if(mime < 0) { + LM_ERR("failed to parse Content-Type header\n"); + return -1; + } + if(msg->content_type == NULL) { + LM_ERR("missing Content-Type header for existing message body\n"); + return -1; + } + off = body.s - msg->buf; if((l = anchor_lump(msg, off + body.len, 0, 0)) == 0) { - LM_ERR("WTF\n"); + LM_ERR("failed to anchor lump\n"); + return -1; + } + if(mime != MIMETYPE(MULTIPART, MIXED)) { + LM_ERR("message body is not multipart/mixed\n"); return -1; } /* get delimiter no initial -- */ _______________________________________________ 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!
