nat: Make rewrite work on string, read to a string first, copy to msgb

The MGCP protocol parsing is adding '\0' to make sure we do not
parse beyond where we should parse. This does not mix with strtok
or similiar routines.
For now we will read the msg into a global array first, then copy
it to the msgb for mgcp protocol handling and if we are required
to forward it to the MGCP we have a untouched copy we will modify
into our own msgb.
diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c
index 10b876b..def6bfe 100644
--- a/openbsc/tests/bsc-nat/bsc_nat_test.c
+++ b/openbsc/tests/bsc-nat/bsc_nat_test.c
@@ -425,20 +425,18 @@
 static void test_mgcp_rewrite(void)
 {
 	int i;
-	struct msgb *input, *output;
+	struct msgb *output;
 	fprintf(stderr, "Test rewriting MGCP messages.\n");
 
-	input = msgb_alloc(4096, "input");
-
 	for (i = 0; i < ARRAY_SIZE(mgcp_messages); ++i) {
 		const char *orig = mgcp_messages[i].orig;
 		const char *patc = mgcp_messages[i].patch;
 		const char *ip = mgcp_messages[i].ip;
 		const int port = mgcp_messages[i].port;
 
-		copy_to_msg(input, (const u_int8_t *) orig, strlen(orig) + 1);
+		char *input = strdup(orig);
 
-		output = bsc_mgcp_rewrite(input, ip, port);
+		output = bsc_mgcp_rewrite(input, strlen(input), ip, port);
 		if (msgb_l2len(output) != strlen(patc)) {
 			fprintf(stderr, "Wrong sizes for test: %d  %d != %d != %d\n", i, msgb_l2len(output), strlen(patc), strlen(orig));
 			fprintf(stderr, "String '%s' vs '%s'\n", (const char *) output->l2h, patc);
@@ -451,9 +449,8 @@
 		}
 
 		msgb_free(output);
+		free(input);
 	}
-
-	msgb_free(input);
 }
 
 static void test_mgcp_parse(void)