I have an buffer of size 101
char buffer[101]
I am trying to copy an address to the array
int i;
for(i=0;i<sizeof(buffer);i+=4)
*(long*)&buffer[i] = address
in which address is of type long.
However I met with a stack smashing detection when I am running it. Any idea why?
Alignment issues aside,
when
i == 100you write past the allocated buffer. You should stop wheni > sizeof buffer - 4.