for some reason this gives me a seg fault, i cant see why. all my pointers are assigned to valid vars or NULL.

Code:
#include <stdio.h>
#include <string.h>

int main() {
	char temp[] = "test<abc>data</cba>test";
	remove_tag(temp);
	
	return 0;
}

int remove_tag(char *data) {
	char value[255];
		strcpy(value, data);
	int x = 0;

	int y = 0;
	
	char *start = strchr(data, '<'); /* Find the start of a tag. */
	char *end = strchr(data, '>');   /* Find the end of a tag. */
		end = strchr(data, '>');

	while(x < *start) { /* Copy everything before the tag. */
		data[x] = value[y];

		++x;
		++y;
	}

	x = *end + 1;

	while(data[x] != '\0') { /* Copy everything after the tag*/
		data[x] = value[y];

		++x;
		++y;
	}	

	strcpy(data, value);
	
	return 0;		
}