BUG/MAJOR: trash must always be the size of a buffer

Before it was possible to resize the buffers using global.tune.bufsize,
the trash has always been the size of a buffer by design. Unfortunately,
the recent buffer sizing at runtime forgot to adjust the trash, resulting
in it being too short for content rewriting if buffers were enlarged from
the default value.

The bug was encountered in 1.4 so the fix must be backported there.
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 49d1dbe..b3ae050 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -528,6 +528,8 @@
 		global.tune.bufsize = atol(args[1]);
 		if (global.tune.maxrewrite >= global.tune.bufsize / 2)
 			global.tune.maxrewrite = global.tune.bufsize / 2;
+		trashlen = global.tune.bufsize;
+		trash = realloc(trash, trashlen);
 	}
 	else if (!strcmp(args[0], "tune.maxrewrite")) {
 		if (*(args[1]) == 0) {
@@ -1032,7 +1034,7 @@
 					continue;
 				if (strcmp(kwl->kw[index].kw, args[0]) == 0) {
 					/* prepare error message just in case */
-					snprintf(trash, sizeof(trash),
+					snprintf(trash, trashlen,
 						 "error near '%s' in '%s' section", args[0], "global");
 					rc = kwl->kw[index].parse(args, CFG_GLOBAL, NULL, NULL, &errmsg);
 					if (rc < 0) {
@@ -3016,7 +3018,7 @@
 			goto out;
 		}
 
-		expr = sample_parse_expr(args, &myidx, trash, sizeof(trash));
+		expr = sample_parse_expr(args, &myidx, trash, trashlen);
 		if (!expr) {
 			Alert("parsing [%s:%d] : '%s': %s\n", file, linenum, args[0], trash);
 			err_code |= ERR_ALERT | ERR_FATAL;
@@ -5255,7 +5257,7 @@
 					continue;
 				if (strcmp(kwl->kw[index].kw, args[0]) == 0) {
 					/* prepare error message just in case */
-					snprintf(trash, sizeof(trash),
+					snprintf(trash, trashlen,
 						 "error near '%s' in %s section", args[0], cursection);
 					rc = kwl->kw[index].parse(args, CFG_LISTEN, curproxy, &defproxy, &errmsg);
 					if (rc < 0) {