Skip to content

Commit 4e60fd5

Browse files
committed
C++:Add the ImproperNullTerminationTainted.ql query to the test.
1 parent ccf1a44 commit 4e60fd5

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| test.cpp:410:10:410:15 | buffer | $@ flows to here and may not be null terminated. | test.cpp:409:18:409:23 | buffer | User-provided value |
2+
| test.cpp:425:10:425:15 | buffer | $@ flows to here and may not be null terminated. | test.cpp:424:9:424:14 | buffer | User-provided value |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Security/CWE/CWE-170/ImproperNullTerminationTainted.ql

cpp/ql/test/query-tests/Likely Bugs/Memory Management/ImproperNullTermination/test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ void test_read_fread(int read_src, FILE *s)
407407
char buffer[buffer_size];
408408

409409
read(read_src, buffer, buffer_size * sizeof(char));
410-
strlen(buffer); // BAD [NOT DETECTED]
410+
strlen(buffer); // BAD
411411
}
412412

413413
{
@@ -422,7 +422,7 @@ void test_read_fread(int read_src, FILE *s)
422422
char buffer[buffer_size];
423423

424424
fread(buffer, sizeof(char), buffer_size, s);
425-
strlen(buffer); // BAD [NOT DETECTED]
425+
strlen(buffer); // BAD
426426
}
427427

428428
{

0 commit comments

Comments
 (0)