I don’t have it, but I read that Mac OS handles overflow differently, this will not allow you to overwrite incremental memory instances. strcpy() is one of them
On a Linux machine, this code successfully overwrites the next stack, but is prevented on mac os (interrupt interruption) due to the canary stack .
You might be able to get around this with the gcc -fno-stack-protector option
Good, since you see an interrupt from __strcpy_chk , which would mean its concrete check with strcpy (and probably friends). Therefore, theoretically you can do the following:
char teststrcpy[5]; gets(teststrcpy);
Then enter your very long line, and it should behave badly as you wish.
* I recommend only gets in this particular case, trying to get around the OS protection mechanisms that exist. In NO other cases, I would suggest anyone use the code. gets not safe.
source share