diff --git a/cpp/ql/test/query-tests/Likely Bugs/Memory Management/ReturnStackAllocatedMemory/test.cpp b/cpp/ql/test/query-tests/Likely Bugs/Memory Management/ReturnStackAllocatedMemory/test.cpp index 487a4e77285..6818300d10d 100644 --- a/cpp/ql/test/query-tests/Likely Bugs/Memory Management/ReturnStackAllocatedMemory/test.cpp +++ b/cpp/ql/test/query-tests/Likely Bugs/Memory Management/ReturnStackAllocatedMemory/test.cpp @@ -229,4 +229,23 @@ int* id(int* px) { void f() { int x; int* px = id(&x); // GOOD +} + +void *alloca(size_t); + +void* test_alloca() { + void* p = alloca(10); + return p; // BAD [NOT DETECTED] +} + +char *strdupa(const char *); +char *strndupa(const char *, size_t); + +char* test_strdupa(const char* s) { + return strdupa(s); // BAD [NOT DETECTED] +} + +void* test_strndupa(const char* s, size_t size) { + char* s2 = strndupa(s, size); + return s2; // BAD [NOT DETECTED] } \ No newline at end of file