I tried this sample c code:
int main() { int array[5]; int i; for (i = 0; i <= 255; i++) { array[i] = 10; } }
Try:
sudo echo 0 > /proc/sys/kernel/randomize_va_space
And compile again like this:
gcc buffer2.c -o buffer2 -fno-stack-protector