mirror of
https://github.com/github/codeql.git
synced 2026-05-01 11:45:14 +02:00
CPP: Remove the overlap between these two queries.
This commit is contained in:
@@ -28,12 +28,6 @@ class MallocCall extends FunctionCall
|
||||
}
|
||||
}
|
||||
|
||||
predicate terminationProblem(MallocCall malloc, string msg)
|
||||
{
|
||||
malloc.getAllocatedSize() instanceof StrlenCall and
|
||||
msg = "This allocation does not include space to null-terminate the string."
|
||||
}
|
||||
|
||||
predicate spaceProblem(FunctionCall append, string msg)
|
||||
{
|
||||
exists(MallocCall malloc, StrlenCall strlen, AddExpr add, FunctionCall insert, Variable buffer |
|
||||
@@ -51,5 +45,5 @@ predicate spaceProblem(FunctionCall append, string msg)
|
||||
}
|
||||
|
||||
from Expr problem, string msg
|
||||
where terminationProblem(problem, msg) or spaceProblem(problem, msg)
|
||||
where spaceProblem(problem, msg)
|
||||
select problem, msg
|
||||
|
||||
@@ -1,6 +1 @@
|
||||
| tests1.cpp:26:21:26:26 | call to malloc | This allocation does not include space to null-terminate the string. |
|
||||
| tests1.cpp:67:21:67:26 | call to malloc | This allocation does not include space to null-terminate the string. |
|
||||
| tests1.cpp:89:25:89:30 | call to malloc | This allocation does not include space to null-terminate the string. |
|
||||
| tests2.cpp:34:4:34:9 | call to strcat | This buffer only contains enough room for 'str1' (copied on line 33) |
|
||||
| tests3.cpp:25:21:25:31 | call to malloc | This allocation does not include space to null-terminate the string. |
|
||||
| tests3.cpp:30:21:30:31 | call to malloc | This allocation does not include space to null-terminate the string. |
|
||||
|
||||
Reference in New Issue
Block a user