biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / test / cc-wrapper / fortify1-example.c
blob48b9c268e728e8ff62990576480b919ee2153c93
1 /* an example that should be protected by FORTIFY_SOURCE=1 */
2 #include <stdio.h>
3 #include <string.h>
4 #include <stdlib.h>
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]);
14 puts(buffer);
15 return 0;