C++: Fill out ArrayFunction model for 'fgets'.

This commit is contained in:
Geoffrey White
2020-06-03 14:36:33 +01:00
parent 1b8f3c4b84
commit b38a7a9ffc

View File

@@ -48,4 +48,16 @@ class GetsFunction extends DataFlowFunction, TaintFunction, ArrayFunction, Alias
output.isParameterDeref(0) and output.isParameterDeref(0) and
description = "String read by " + this.getName() description = "String read by " + this.getName()
} }
override predicate hasArrayWithVariableSize(int bufParam, int countParam) {
not hasGlobalOrStdName("gets") and
bufParam = 0 and countParam = 1
}
override predicate hasArrayWithUnknownSize(int bufParam) {
hasGlobalOrStdName("gets") and
bufParam = 0
}
override predicate hasArrayOutput(int bufParam) { bufParam = 0 }
} }