Skip to content

Commit 12cd09d

Browse files
committed
C++: Delete the experimental query and its tests, and accept the test changes.
1 parent 8d0cfb4 commit 12cd09d

7 files changed

+9
-131
lines changed

cpp/ql/src/experimental/Security/CWE/CWE-788/AccessOfMemoryLocationAfterEndOfBufferUsingStrncat.c

Lines changed: 0 additions & 4 deletions
This file was deleted.

cpp/ql/src/experimental/Security/CWE/CWE-788/AccessOfMemoryLocationAfterEndOfBufferUsingStrncat.qhelp

Lines changed: 0 additions & 32 deletions
This file was deleted.

cpp/ql/src/experimental/Security/CWE/CWE-788/AccessOfMemoryLocationAfterEndOfBufferUsingStrncat.ql

Lines changed: 0 additions & 42 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
| test.c:54:3:54:24 | ... = ... | potential unsafe or redundant assignment. |
2-
| test.c:55:3:55:40 | ... = ... | potential unsafe or redundant assignment. |
3-
| test.c:56:3:56:44 | ... = ... | potential unsafe or redundant assignment. |
4-
| test.c:57:3:57:44 | ... = ... | potential unsafe or redundant assignment. |
5-
| test.c:58:3:58:48 | ... = ... | potential unsafe or redundant assignment. |
6-
| test.c:59:3:59:48 | ... = ... | potential unsafe or redundant assignment. |
7-
| test.c:60:3:60:52 | ... = ... | potential unsafe or redundant assignment. |
8-
| test.c:61:3:61:50 | ... = ... | potential unsafe or redundant assignment. |
9-
| test.c:62:3:62:54 | ... = ... | potential unsafe or redundant assignment. |
1+
| test.c:16:3:16:24 | ... = ... | potential unsafe or redundant assignment. |
2+
| test.c:17:3:17:40 | ... = ... | potential unsafe or redundant assignment. |
3+
| test.c:18:3:18:44 | ... = ... | potential unsafe or redundant assignment. |
4+
| test.c:19:3:19:44 | ... = ... | potential unsafe or redundant assignment. |
5+
| test.c:20:3:20:48 | ... = ... | potential unsafe or redundant assignment. |
6+
| test.c:21:3:21:48 | ... = ... | potential unsafe or redundant assignment. |
7+
| test.c:22:3:22:52 | ... = ... | potential unsafe or redundant assignment. |
8+
| test.c:23:3:23:50 | ... = ... | potential unsafe or redundant assignment. |
9+
| test.c:24:3:24:54 | ... = ... | potential unsafe or redundant assignment. |

cpp/ql/test/experimental/query-tests/Security/CWE/CWE-788/semmle/tests/AccessOfMemoryLocationAfterEndOfBufferUsingStrncat.expected

Lines changed: 0 additions & 5 deletions
This file was deleted.

cpp/ql/test/experimental/query-tests/Security/CWE/CWE-788/semmle/tests/AccessOfMemoryLocationAfterEndOfBufferUsingStrncat.qlref

Lines changed: 0 additions & 1 deletion
This file was deleted.

cpp/ql/test/experimental/query-tests/Security/CWE/CWE-788/semmle/tests/test.c

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,12 @@ char * strncat(char*, const char*, unsigned);
22
unsigned strlen(const char*);
33
void* malloc(unsigned);
44

5-
void strncat_test1(char *s) {
6-
char buf[80];
7-
strncat(buf, s, sizeof(buf) - strlen(buf) - 1); // GOOD
8-
strncat(buf, s, sizeof(buf) - strlen(buf)); // BAD
9-
strncat(buf, "fix", sizeof(buf)-strlen(buf)); // BAD
10-
}
11-
12-
#define MAX_SIZE 80
13-
14-
void strncat_test2(char *s) {
15-
char buf[MAX_SIZE];
16-
strncat(buf, s, MAX_SIZE - strlen(buf) - 1); // GOOD
17-
strncat(buf, s, MAX_SIZE - strlen(buf)); // BAD
18-
strncat(buf, "fix", MAX_SIZE - strlen(buf)); // BAD
19-
}
20-
21-
void strncat_test3(char *s) {
22-
int len = 80;
23-
char* buf = (char *) malloc(len);
24-
strncat(buf, s, len - strlen(buf) - 1); // GOOD
25-
strncat(buf, s, len - strlen(buf)); // BAD [NOT DETECTED]
26-
strncat(buf, "fix", len - strlen(buf)); // BAD [NOT DETECTED]
27-
}
28-
29-
void strncat_test4(char *s) {
30-
int len = 80;
31-
char* buf = (char *) malloc(len + 1);
32-
strncat(buf, s, len - strlen(buf) - 1); // GOOD
33-
strncat(buf, s, len - strlen(buf)); // GOOD
34-
}
35-
365
struct buffers
376
{
387
unsigned char array[50];
398
unsigned char *pointer;
409
} globalBuff1,*globalBuff2,globalBuff1_c,*globalBuff2_c;
4110

42-
void strncat_test5(char* s, struct buffers* buffers) {
43-
unsigned len_array = strlen(buffers->array);
44-
unsigned max_size = sizeof(buffers->array);
45-
unsigned free_size = max_size - len_array;
46-
strncat(buffers->array, s, free_size); // BAD
47-
}
48-
4911
void strlen_test1(){
5012
unsigned char buff1[12];
5113
struct buffers buffAll;

0 commit comments

Comments
 (0)