Skip to content

Commit 3e6576b

Browse files
committed
C++: Add example of missing result.
1 parent d1cf688 commit 3e6576b

File tree

1 file changed

+10
-0
lines changed
  • cpp/ql/test/experimental/query-tests/Security/CWE/CWE-193/pointer-deref

1 file changed

+10
-0
lines changed

cpp/ql/test/experimental/query-tests/Security/CWE/CWE-193/pointer-deref/test.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,13 @@ void test10_callee(array_t *arr) {
179179
void test10(int size) {
180180
test10_callee(mk_array_p(size));
181181
}
182+
183+
void deref_plus_one(char* q) {
184+
char a = *(q + 1); // BAD [NOT DETECTED]
185+
}
186+
187+
void test11(unsigned size) {
188+
char *p = malloc(size);
189+
char *q = p + size - 1;
190+
deref_plus_one(q);
191+
}

0 commit comments

Comments
 (0)