Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3038823

Browse files
committed
C++: Add some test cases for new (real) taint sources to be defined using models-as-data.
1 parent 9611e4c commit 3038823

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

cpp/ql/test/library-tests/dataflow/source-sink-tests/sources-and-sinks.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,38 @@ void test_inet(char *hostname, char *servname, struct addrinfo *hints) {
5050
addrinfo *res;
5151
int ret = getaddrinfo(hostname, servname, hints, &res); // $ remote_source
5252
}
53+
54+
typedef unsigned int wint_t;
55+
56+
// getc variants
57+
int getc(FILE *stream);
58+
wint_t getwc(FILE *stream);
59+
int _getc_nolock(FILE *stream);
60+
wint_t _getwc_nolock(FILE *stream);
61+
62+
int getch(void);
63+
int _getch(void);
64+
wint_t _getwch(void);
65+
int _getch_nolock(void);
66+
wint_t _getwch_nolock(void);
67+
int getchar(void);
68+
wint_t getwchar();
69+
int _getchar_nolock(void);
70+
wint_t _getwchar_nolock(void);
71+
72+
void test_getchar(FILE *stream) {
73+
int a = getc(stream); // $ MISSING: remote_source
74+
wint_t b = getwc(stream); // $ MISSING: remote_source
75+
int c = _getc_nolock(stream); // $ MISSING: remote_source
76+
wint_t d = _getwc_nolock(stream); // $ MISSING: remote_source
77+
78+
int e = getch(); // $ MISSING: local_source
79+
int f = _getch(); // $ MISSING: local_source
80+
wint_t g = _getwch(); // $ MISSING: local_source
81+
int h = _getch_nolock(); // $ MISSING: local_source
82+
wint_t i = _getwch_nolock(); // $ MISSING: local_source
83+
int j = getchar(); // $ MISSING: local_source
84+
wint_t k = getwchar(); // $ MISSING: local_source
85+
int l = _getchar_nolock(); // $ MISSING: local_source
86+
wint_t m = _getwchar_nolock(); // $ MISSING: local_source
87+
}

0 commit comments

Comments
 (0)