Is there any change wrt to FORTIFY_SOURCE in gcc 10.2.0. I am not getting compiler warnings for buffer overflow during build but buffer overflow is detected during runtime and the program terminates.
I have set the flags -O2 -g -D_FORTIFY_SOURCE=2. Previously on gcc7.3, this implementation did give me the compiler warnings as well as the runtime warnings. Now I am not getting any compiler warnings and I have just updated the gcc version.
Also for information I have -Wall and -Wextra flags enabled as well.
here is my main.cpp file
#include "stdio.h"
#include "string.h"
int main(void)
{
char var1[5];
char var2[9];
printf("size of var1",var1,sizeof(var1));
strcpy(var1,"abcdefghi");
memcpy(&var1,&var2,10);
printf("size of var1",var1,sizeof(var1));
return 0;
}
Have been stuck on it for days so would really appreciate some help.