File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
cpp/ql/src/Security/CWE/CWE-131 Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -22,19 +22,15 @@ class MallocCall extends FunctionCall {
2222 MallocCall ( ) { this .getTarget ( ) .hasGlobalOrStdName ( "malloc" ) }
2323
2424 Expr getAllocatedSize ( ) {
25- if this .getArgument ( 0 ) instanceof VariableAccess
26- then
27- exists ( LocalScopeVariable v , ControlFlowNode def |
28- definitionUsePair ( v , def , this .getArgument ( 0 ) ) and
29- exprDefinition ( v , def , result )
30- )
31- else result = this .getArgument ( 0 )
25+ result = this .getArgument ( 0 )
3226 }
3327}
3428
3529predicate terminationProblem ( MallocCall malloc , string msg ) {
3630 // malloc(strlen(...))
37- malloc .getAllocatedSize ( ) instanceof StrlenCall and
31+ exists ( StrlenCall strlen |
32+ DataFlow:: localExprFlow ( strlen , malloc .getAllocatedSize ( ) )
33+ ) and
3834 // flows into a null-terminated string function
3935 exists ( ArrayFunction af , FunctionCall fc , int arg |
4036 DataFlow:: localExprFlow ( malloc , fc .getArgument ( arg ) ) and
You can’t perform that action at this time.
0 commit comments