1 /* an example that should be protected by FORTIFY_SOURCE=1 */
7 int main(int argc
, char *argv
[]) {
8 /* allocate on the heap so we're likely to get an
9 * over-allocation and can be more sure that a
10 * failure is because of fortify protection rather
11 * than a genuine segfault */
12 char* buffer
= malloc(sizeof(char) * 7);
13 strcpy(buffer
, argv
[1]);