summary refs log tree commit diff
path: root/pkgs/test/cc-wrapper/fortify2-example.c
blob: dfb5a8e872944ca59ce05268d829ba3af8d1c564 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* an example that should be protected by FORTIFY_SOURCE=2 but
 * not FORTIFY_SOURCE=1 */
#include <stdio.h>
#include <string.h>

struct buffer_with_pad {
    char buffer[7];
    char pad[25];
};

int main(int argc, char *argv[]) {
    struct buffer_with_pad b;
    strcpy(b.buffer, argv[1]);
    puts(b.buffer);
    return 0;
}