Merge pull request #186 from Semmle/rc/1.18

Approved by esben-semmle
This commit is contained in:
semmle-qlci
2018-09-13 12:34:54 +01:00
committed by GitHub
26 changed files with 780 additions and 200 deletions

View File

@@ -29,11 +29,20 @@ predicate isEffectivelyConstAccess(VariableAccess a)
)
}
from FunctionCall fc, VariableAccess src
where fc.getTarget().hasName("strcat") and
src = fc.getArgument(1) and
not src.getType() instanceof ArrayType and
class StrcatSource extends VariableAccess {
FunctionCall strcat;
StrcatSource() {
strcat.getTarget().hasName("strcat") and
this = strcat.getArgument(1)
}
FunctionCall getStrcatCall() { result = strcat }
}
from StrcatSource src
where not src.getType() instanceof ArrayType and
not exists(BufferSizeExpr bse |
bse.getArg().(VariableAccess).getTarget() = src.getTarget()) and
not isEffectivelyConstAccess(src)
select fc, "Always check the size of the source buffer when using strcat."
select src.getStrcatCall(), "Always check the size of the source buffer when using strcat."