mirror of
https://github.com/github/codeql.git
synced 2026-04-24 16:25:15 +02:00
C++: Test case for cpp/badly-bounded-write
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
| errors.c:10:5:10:12 | call to swprintf | This 'call to swprintf' operation is limited to 12 bytes but the destination is only 3 bytes. |
|
||||
| tests.c:43:3:43:10 | call to snprintf | This 'call to snprintf' operation is limited to 111 bytes but the destination is only 110 bytes. |
|
||||
| tests.c:46:3:46:10 | call to snprintf | This 'call to snprintf' operation is limited to 111 bytes but the destination is only 110 bytes. |
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// semmle-extractor-options: --expect_errors
|
||||
|
||||
typedef unsigned long size_t;
|
||||
typedef int wchar_t;
|
||||
|
||||
int swprintf(wchar_t *s, size_t n, const wchar_t *format, ...);
|
||||
|
||||
void test_extraction_errors() {
|
||||
WCHAR buffer[3];
|
||||
swprintf(buffer, 3, L"abc");
|
||||
}
|
||||
Reference in New Issue
Block a user