add a fortified implementation of getcwd
Change-Id: Ice3e6d3e1ff07788305dc85f8ee4059baad5fac4
diff --git a/tests/fortify_compilation_test.cpp b/tests/fortify_compilation_test.cpp
index 166e8d9..072006e 100644
--- a/tests/fortify_compilation_test.cpp
+++ b/tests/fortify_compilation_test.cpp
@@ -262,3 +262,11 @@
// clang should emit a warning, but doesn't
fwrite(buf, 1, 5, stdout);
}
+
+void test_getcwd() {
+ char buf[4];
+ // NOLINTNEXTLINE(whitespace/line_length)
+ // GCC: error: call to '__getcwd_dest_size_error' declared with attribute error: getcwd called with size bigger than destination
+ // clang should emit a warning, but doesn't
+ getcwd(buf, 5);
+}