How to turn off gcc compiler optimization to enable buffer overflow
I see that a command like gcc vuln.c -o vuln_disable_canary -fno-stack-protector
is said to disable canary.
I tried the following example, the vanilla gcc command generates a file without canary.
Does anybody know how to disable/enable canary?
$ cat helloworld.c
#include <stdio.h>
int main() {
puts("Hello World!");
}
$ gcc helloworld.c
$ gcc helloworld.c -o no_canary.out -fno-stack-protector
$ rabin2 -I a.out | grep canary
canary false
$ rabin2 -I no_canary.out | grep canary
canary false
BTW, what does the name canary mean?