Created
September 1, 2025 15:27
-
-
Save saghul/3043e6499a745c106cdc094b1ad76572 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/pjsip/src/pjsip/sip_parser.c b/pjsip/src/pjsip/sip_parser.c | |
index 5dc10b47e..e1ba192c5 100644 | |
--- a/pjsip/src/pjsip/sip_parser.c | |
+++ b/pjsip/src/pjsip/sip_parser.c | |
@@ -1132,21 +1132,26 @@ parse_headers: | |
/* If we have Content-Type header, treat the rest of the message | |
* as body. | |
*/ | |
- if (ctype_hdr && scanner->curptr!=scanner->end) { | |
+ if (scanner->curptr!=scanner->end) { | |
/* New: if Content-Type indicates that this is a multipart | |
* message body, parse it. | |
*/ | |
const pj_str_t STR_MULTIPART = { "multipart", 9 }; | |
pjsip_msg_body *body; | |
- if (pj_stricmp(&ctype_hdr->media.type, &STR_MULTIPART)==0) { | |
+ if (ctype_hdr && pj_stricmp(&ctype_hdr->media.type, &STR_MULTIPART)==0) { | |
body = pjsip_multipart_parse(pool, scanner->curptr, | |
scanner->end - scanner->curptr, | |
&ctype_hdr->media, 0); | |
} else { | |
body = PJ_POOL_ALLOC_T(pool, pjsip_msg_body); | |
- pjsip_media_type_cp(pool, &body->content_type, | |
- &ctype_hdr->media); | |
+ if (ctype_hdr) { | |
+ pjsip_media_type_cp(pool, &body->content_type, | |
+ &ctype_hdr->media); | |
+ } else { | |
+ // HACK: Assume messages with a body but no Content-Type header contain an SDP | |
+ pjsip_media_type_init2(&body->content_type, "application", "sdp"); | |
+ } | |
body->data = scanner->curptr; | |
body->len = (unsigned)(scanner->end - scanner->curptr); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment