]> granicus.if.org Git - clang/commitdiff
Add test case for mktemp. Patch by Lei Zhang.
authorZhongxing Xu <xuzhongxing@gmail.com>
Sun, 6 Dec 2009 12:45:46 +0000 (12:45 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Sun, 6 Dec 2009 12:45:46 +0000 (12:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90706 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/security-syntax-checks.m

index bcdc65ebd4591e063fe5179e8cdaa5f469cd67cb..2ce0684312c464764c39da1d91cdfd9ceb5978e1 100644 (file)
@@ -96,3 +96,9 @@ void test_rand()
   rand_r(&b);  // expected-warning{{Function 'rand_r' is obsolete because it implements a poor random number generator.  Use 'arc4random' instead}}
   random();    // expected-warning{{The 'random' function produces a sequence of values that an adversary may be able to predict.  Use 'arc4random' instead}}
 }
+
+char *mktemp(char *buf);
+
+void test_mktemp() {
+  char *x = mktemp("/tmp/zxcv"); // expected-warning{{Call to function 'mktemp' is insecure as it always creates or uses insecure temporary file}}
+}