1 // RUN: %clang_analyze_cc1 \
2 // RUN: -analyzer-checker=alpha.security.cert.pos.34c\
5 #include "../Inputs/system-header-simulator.h"
6 void free(void *memblock
);
7 void *malloc(size_t size
);
11 namespace test_auto_var_used_good
{
15 return putenv(ex
); // no-warning: extern storage class.
19 char *buffer
= (char *)"huttah!";
20 if (rand() % 2 == 0) {
21 buffer
= (char *)malloc(5);
22 strcpy(buffer
, "woot");
28 char *buffer
= (char *)malloc(5);
29 strcpy(buffer
, "woot");
31 if (rand() % 2 == 0) {
33 buffer
= (char *)"blah blah blah";
39 char env
[] = "NAME=value";
40 // TODO: False Positive
42 // expected-warning@-1 {{The 'putenv' function should not be called with arguments that have automatic storage}}
48 putenv((char *)"NAME=anothervalue");
51 } // namespace test_auto_var_used_good