]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Analysis/taint-diagnostic-visitor.c
Vendor import of clang trunk r300422:
[FreeBSD/FreeBSD.git] / test / Analysis / taint-diagnostic-visitor.c
1 // RUN: %clang_cc1 -analyze -analyzer-checker=alpha.security.taint,core -analyzer-output=text -verify %s
2
3 // This file is for testing enhanced diagnostics produced by the GenericTaintChecker
4
5 int scanf(const char *restrict format, ...);
6 int system(const char *command);
7
8 void taintDiagnostic()
9 {
10   char buf[128];
11   scanf("%s", buf); // expected-note {{Taint originated here}}
12   system(buf); // expected-warning {{Untrusted data is passed to a system call}} // expected-note {{Untrusted data is passed to a system call (CERT/STR02-C. Sanitize data passed to complex subsystems)}}
13 }