Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 57a4e52

Browse files
committed
CPP: Remove the overlap between these two queries.
1 parent ca6ba36 commit 57a4e52

2 files changed

Lines changed: 1 addition & 12 deletions

File tree

cpp/ql/src/Critical/OverflowCalculated.ql

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ class MallocCall extends FunctionCall
2828
}
2929
}
3030

31-
predicate terminationProblem(MallocCall malloc, string msg)
32-
{
33-
malloc.getAllocatedSize() instanceof StrlenCall and
34-
msg = "This allocation does not include space to null-terminate the string."
35-
}
36-
3731
predicate spaceProblem(FunctionCall append, string msg)
3832
{
3933
exists(MallocCall malloc, StrlenCall strlen, AddExpr add, FunctionCall insert, Variable buffer |
@@ -51,5 +45,5 @@ predicate spaceProblem(FunctionCall append, string msg)
5145
}
5246

5347
from Expr problem, string msg
54-
where terminationProblem(problem, msg) or spaceProblem(problem, msg)
48+
where spaceProblem(problem, msg)
5549
select problem, msg
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
| tests1.cpp:26:21:26:26 | call to malloc | This allocation does not include space to null-terminate the string. |
2-
| tests1.cpp:67:21:67:26 | call to malloc | This allocation does not include space to null-terminate the string. |
3-
| tests1.cpp:89:25:89:30 | call to malloc | This allocation does not include space to null-terminate the string. |
41
| tests2.cpp:34:4:34:9 | call to strcat | This buffer only contains enough room for 'str1' (copied on line 33) |
5-
| tests3.cpp:25:21:25:31 | call to malloc | This allocation does not include space to null-terminate the string. |
6-
| tests3.cpp:30:21:30:31 | call to malloc | This allocation does not include space to null-terminate the string. |

0 commit comments

Comments
 (0)