Sophie

Sophie

distrib > Mageia > 6 > armv7hl > media > core-updates-src > by-pkgid > 8922238eda28e5e08b0a38cfb06949eb > files > 4

pjproject-2.5.5-4.1.mga6.src.rpm

Backports of

From: Mark Michelson <mmichelson@digium.com>
Date: Thu, 13 Apr 2017 16:59:40 -0500
Subject: Parse zero-length multipart body parts correctly.

From: Mark Michelson <mmichelson@digium.com>
Date: Thu, 13 Apr 2017 16:20:07 -0500
Subject: Ensure 2543 transaction key buffer is large enough.

diff -Nru a/pjsip/src/pjsip/sip_multipart.c b/pjsip/src/pjsip/sip_multipart.c
--- a/pjsip/src/pjsip/sip_multipart.c	2015-08-25 10:45:46.000000000 +0200
+++ b/pjsip/src/pjsip/sip_multipart.c	2017-08-12 09:30:18.412354340 +0200
@@ -640,13 +640,18 @@
 
 	end_body = curptr;
 
-	/* The newline preceeding the delimiter is conceptually part of
-	 * the delimiter, so trim it from the body.
+	/* Note that when body is empty, end_body will be equal
+	 * to start_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.
diff -Nru a/pjsip/src/pjsip/sip_transaction.c b/pjsip/src/pjsip/sip_transaction.c
--- a/pjsip/src/pjsip/sip_transaction.c	2016-02-22 14:36:31.000000000 +0100
+++ b/pjsip/src/pjsip/sip_transaction.c	2017-08-12 09:38:28.836321244 +0200
@@ -288,7 +288,8 @@
     host = &rdata->msg_info.via->sent_by.host;
 
     /* Calculate length required. */
-    len_required = 9 +			    /* CSeq number */
+    len_required = method->name.slen +      /* Method */
+		   9 +			    /* CSeq number */
 		   rdata->msg_info.from->tag.slen +   /* From tag. */
 		   rdata->msg_info.cid->id.slen +    /* Call-ID */
 		   host->slen +		    /* Via host. */