you have made an memory-voilation.
you have to make a new array and copy the old one. memcpy dosn't make a new array or enlarges it for you!
char buf1[1];
int size=1;
char *buf2=malloc(sizeof(char)*size);
char *temp = 0;
while(recv(new_fd,buf1,sizeof(buf1),0))
{
temp = malloc(sizeof(char)*size);
memcpy(temp,buf2,sizeof(buf2));
memcpy(temp+size-1,buf1,sizeof(buf1));
free(buf2);
buf2 = temp;
temp = 0;
size++;
printf("size: %d\n",size);
printf("buf2: %s\n",buf2);
};
that should work