C++: Respond to review comments.

This commit is contained in:
Mathias Vorreiter Pedersen
2021-01-28 16:39:11 +01:00
parent 7affbfc6cb
commit 75aa1e8a3b
2 changed files with 12 additions and 2 deletions

View File

@@ -22,6 +22,12 @@ private class StrsetFunction extends ArrayFunction, DataFlowFunction, AliasFunct
])
}
override predicate hasArrayWithNullTerminator(int bufParam) { bufParam = 0 }
override predicate hasArrayInput(int bufParam) { bufParam = 0 }
override predicate hasArrayOutput(int bufParam) { bufParam = 0 }
override predicate hasDataFlow(FunctionInput input, FunctionOutput output) {
// flow from the character that overrides the string
input.isParameter(1) and
@@ -49,4 +55,8 @@ private class StrsetFunction extends ArrayFunction, DataFlowFunction, AliasFunct
override predicate hasSpecificWriteSideEffect(ParameterIndex i, boolean buffer, boolean mustWrite) {
i = 0 and buffer = true and mustWrite = true
}
override predicate hasSpecificReadSideEffect(ParameterIndex i, boolean buffer) {
i = 0 and buffer = true
}
}

View File

@@ -35,9 +35,9 @@ private class Strtok extends ArrayFunction, AliasFunction, TaintFunction, SideEf
input.isParameter(0) and output.isReturnValue()
}
override predicate hasOnlySpecificReadSideEffects() { any() }
override predicate hasOnlySpecificReadSideEffects() { none() }
override predicate hasOnlySpecificWriteSideEffects() { any() }
override predicate hasOnlySpecificWriteSideEffects() { none() }
override predicate hasSpecificWriteSideEffect(ParameterIndex i, boolean buffer, boolean mustWrite) {
i = 0 and buffer = true and mustWrite = false