File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
cpp/ql/src/Likely Bugs/Memory Management Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -29,11 +29,20 @@ predicate isEffectivelyConstAccess(VariableAccess a)
2929 )
3030}
3131
32- from FunctionCall fc , VariableAccess src
33- where fc .getTarget ( ) .hasName ( "strcat" ) and
34- src = fc .getArgument ( 1 ) and
35- not src .getType ( ) instanceof ArrayType and
32+ class StrcatSource extends VariableAccess {
33+ FunctionCall strcat ;
34+
35+ StrcatSource ( ) {
36+ strcat .getTarget ( ) .hasName ( "strcat" ) and
37+ this = strcat .getArgument ( 1 )
38+ }
39+
40+ FunctionCall getStrcatCall ( ) { result = strcat }
41+ }
42+
43+ from StrcatSource src
44+ where not src .getType ( ) instanceof ArrayType and
3645 not exists ( BufferSizeExpr bse |
3746 bse .getArg ( ) .( VariableAccess ) .getTarget ( ) = src .getTarget ( ) ) and
3847 not isEffectivelyConstAccess ( src )
39- select fc , "Always check the size of the source buffer when using strcat."
48+ select src . getStrcatCall ( ) , "Always check the size of the source buffer when using strcat."
You can’t perform that action at this time.
0 commit comments