struct Buffer
  unsigned char pkt[4092];

struct Buffer *start;
start=(struct Buffer *)malloc(sizeof(struct Buffer));

unsigned char *pkt=(unsigned char *)malloc(4092*(sizeof(unsigned char)));
memcpy(&start->pkt,&pkt,len); //Where 'len' is the length of a packet that is stored in 'pkt'.
OUTPUT: Segmentation fault

This code does not show error when compiled but gives error on running.
I tried all in the following but it give same segmentation fault error every time.

It's a bit long code but I only need help in memcpy so that I have pasted the relevant lines. I need to copy the data that is in this 'pkt' to the 'start->pkt' of length 'len'. Appreciate any suggestions or help.

Last edited by kami1219; 10Nov2009 at 02:47..