diff options
author | Mark Michelson <mmichelson@digium.com> | 2017-04-13 17:17:36 -0500 |
---|---|---|
committer | Matthew Fredrickson <creslin@digium.com> | 2017-05-19 11:19:56 -0500 |
commit | 7c0466092ce605fbf5ee895bee0d8fcab5374111 (patch) | |
tree | 12941d9e576e55ec20cb26d9d2a1973a2294e619 /third-party | |
parent | e74c48a46fd65a02ec98440b789ebebd2d8ed1d1 (diff) |
AST-2017-003: Handle zero-length body parts correctly.
ASTERISK-26939 #close
Change-Id: I7ea235ab39833a187db4e078f0788bd0af0a24fd
Diffstat (limited to 'third-party')
-rw-r--r-- | third-party/pjproject/patches/0058-Parse-zero-length-multipart-body-parts-correctly.patch | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/third-party/pjproject/patches/0058-Parse-zero-length-multipart-body-parts-correctly.patch b/third-party/pjproject/patches/0058-Parse-zero-length-multipart-body-parts-correctly.patch new file mode 100644 index 000000000..49334c354 --- /dev/null +++ b/third-party/pjproject/patches/0058-Parse-zero-length-multipart-body-parts-correctly.patch @@ -0,0 +1,41 @@ +From f0c717463d569f87a16f9b014033c8ca8939a7b4 Mon Sep 17 00:00:00 2001 +From: Mark Michelson <mmichelson@digium.com> +Date: Thu, 13 Apr 2017 16:59:40 -0500 +Subject: [PATCH] Parse zero-length multipart body parts correctly. + +The calculation of end_body could result in a negative length being +passed to multipart_body_parse_part(). +--- + pjsip/src/pjsip/sip_multipart.c | 16 +++++++++------- + 1 file changed, 9 insertions(+), 7 deletions(-) + +diff --git a/pjsip/src/pjsip/sip_multipart.c b/pjsip/src/pjsip/sip_multipart.c +index 8351f7e..b302139 100644 +--- a/pjsip/src/pjsip/sip_multipart.c ++++ b/pjsip/src/pjsip/sip_multipart.c +@@ -653,13 +653,15 @@ PJ_DEF(pjsip_msg_body*) pjsip_multipart_parse(pj_pool_t *pool, + + end_body = curptr; + +- /* The newline preceeding the delimiter is conceptually part of +- * the delimiter, so trim it from the body. +- */ +- if (*(end_body-1) == '\n') +- --end_body; +- if (*(end_body-1) == '\r') +- --end_body; ++ if (end_body > start_body) { ++ /* The newline preceeding the delimiter is conceptually part of ++ * the delimiter, so trim it from the body. ++ */ ++ if (*(end_body-1) == '\n') ++ --end_body; ++ if (*(end_body-1) == '\r') ++ --end_body; ++ } + + /* Now that we have determined the part's boundary, parse it + * to get the header and body part of the part. +-- +1.9.1 + |