[PATCH] RFC 2231 Parameter Value Continuations Fix

Dennis Preiser <[email protected]> Mon, 28 Dec 2015 21:14:35 +0100
Newsgroups gmane.network.tin.devel
Message-ID <[email protected]>
--ibTvN161/egqYuK8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Problem:
tin crashes when part number zero ('*0') is absent.

Solution:
Make sure that we use the first available part as starting point.

Dennis

--ibTvN161/egqYuK8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="2015-12-28.diff"

--- tin-2.3.2_r1/src/rfc2046.c	2015-12-24 09:52:24.000000000 +0100
+++ tin-2.3.2_r2/src/rfc2046.c	2015-12-28 20:15:59.000000000 +0100
@@ -419,7 +419,7 @@ get_param(
 				newlen = 0;
 				for (j = 0, c_list = list; c_list != NULL; c_list = c_list->next) {
 					if (strcasecmp(name, c_list->name) == 0) {
-						if (c_list->part == 0)
+						if (c_list->part < p_list->part)
 							p_list = c_list;
 
 						newlen += strlen(c_list->value);
@@ -427,7 +427,7 @@ get_param(
 					}
 				}
 				p_list->value = my_realloc(p_list->value, newlen + 1);
-				for (i = 1; i <= j; ++i) {
+				for (i = p_list->part + 1; i <= j; ++i) {
 					for (c_list = list; c_list != NULL; c_list = c_list->next) {
 						if (strcasecmp(name, c_list->name) == 0) {
 							if (c_list->part == i) {

--ibTvN161/egqYuK8
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KdGluLWRldiBt
YWlsaW5nIGxpc3QKdGluLWRldkB0aW4ub3JnCmh0dHA6Ly9saXN0cy50aW4ub3JnL2NnaS1iaW4v
bWFpbG1hbi9saXN0aW5mby90aW4tZGV2Cg==

--ibTvN161/egqYuK8--