summaryrefslogtreecommitdiff
path: root/pkgs/test/cc-wrapper/fortify3-example.c
blob: 9a0a5f4792c33524e02c9b5105d15b2058f0e720 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
/* an example that should be protected by FORTIFY_SOURCE=3 but
 * not FORTIFY_SOURCE=2 */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>


int main(int argc, char *argv[]) {
    char* buffer = malloc(atoi(argv[2]));
    strcpy(buffer, argv[1]);
    puts(buffer);
    return 0;
}