blob: 679fbc2bf41a0298c5dd16c20e7855bc1cf7c51b [file] [log] [blame]
Anna Zaksb9ac30c2012-01-24 19:32:25 +00001// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.security.taint,debug.TaintTest %s -verify
2
3typedef struct _FILE FILE;
4typedef __typeof(sizeof(int)) size_t;
5extern FILE *stdin;
6typedef long ssize_t;
7ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict);
8int printf(const char * __restrict, ...);
9void free(void *ptr);
10
11struct GetLineTestStruct {
12 ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict);
13};
14
15void getlineTest(void) {
16 FILE *fp;
17 char *line = 0;
18 size_t len = 0;
19 ssize_t read;
20 struct GetLineTestStruct T;
21
22 while ((read = T.getline(&line, &len, stdin)) != -1) {
23 printf("%s", line); // no warning
24 }
25 free(line);
26}