Does someone know why the following lines of code throws a *** stack smashing detected *** error
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv)
{
char x[16];
strcpy(x,"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
}
but the following code does not throw it?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv)
{
char x[16];
x[17] = 'a';
}
Thank you!!
Overwriting x[17]
doesn't overwite the canary-value put before the return address by gcc.