Skip to content

Commit fd74698

Browse files
committed
C++: Test case for cpp/badly-bounded-write
1 parent 9c4030e commit fd74698

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
| 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. |
12
| 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. |
23
| 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. |
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// semmle-extractor-options: --expect_errors
2+
3+
typedef unsigned long size_t;
4+
typedef int wchar_t;
5+
6+
int swprintf(wchar_t *s, size_t n, const wchar_t *format, ...);
7+
8+
void test_extraction_errors() {
9+
WCHAR buffer[3];
10+
swprintf(buffer, 3, L"abc");
11+
}

0 commit comments

Comments
 (0)