C++: Fix 'strtok' model.

This commit is contained in:
Mathias Vorreiter Pedersen
2023-10-25 09:39:36 +01:00
parent f54379d096
commit 032572b924
2 changed files with 3 additions and 1 deletions

View File

@@ -32,6 +32,8 @@ private class Strtok extends ArrayFunction, AliasFunction, TaintFunction, SideEf
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
input.isParameter(0) and output.isReturnValue()
or
input.isParameterDeref(0) and output.isReturnValueDeref()
}
override predicate hasOnlySpecificReadSideEffects() { none() }

View File

@@ -718,6 +718,6 @@ void test_strtok_indirect() {
char *source = indirect_source();
const char* delim = ",.-;:_";
char* tokenized = strtok(source, delim);
sink(*tokenized); // $ MISSING: ast,ir
sink(*tokenized); // $ ir MISSING: ast
sink(*delim);
}