llvm-project/clang/test/Analysis/assume-controlled-environme...

23 lines
750 B
C

// RUN: %clang_analyze_cc1 -verify=untrusted-env %s \
// RUN: -analyzer-checker=core \
// RUN: -analyzer-checker=alpha.security.taint \
// RUN: -analyzer-checker=debug.TaintTest
// RUN: %clang_analyze_cc1 -verify %s -DEXPECT_NO_WARNINGS \
// RUN: -analyzer-config assume-controlled-environment=true \
// RUN: -analyzer-checker=core \
// RUN: -analyzer-checker=alpha.security.taint \
// RUN: -analyzer-checker=debug.TaintTest
#ifdef EXPECT_NO_WARNINGS
// expected-no-diagnostics
#endif
char *getenv(const char *name);
void foo(void) {
char *p = getenv("FOO"); // untrusted-env-warning {{tainted}}
(void)p; // untrusted-env-warning {{tainted}}
}