about summary refs log tree commit diff
path: root/nixpkgs/pkgs/test/cc-wrapper/fortify3-example.c
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/test/cc-wrapper/fortify3-example.c')
-rw-r--r--nixpkgs/pkgs/test/cc-wrapper/fortify3-example.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/test/cc-wrapper/fortify3-example.c b/nixpkgs/pkgs/test/cc-wrapper/fortify3-example.c
new file mode 100644
index 000000000000..9a0a5f4792c3
--- /dev/null
+++ b/nixpkgs/pkgs/test/cc-wrapper/fortify3-example.c
@@ -0,0 +1,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;
+}