Skip to content

Commit 032572b

Browse files
committed
C++: Fix 'strtok' model.
1 parent f54379d commit 032572b

File tree

2 files changed

+3
-1
lines changed
  • cpp/ql
    • lib/semmle/code/cpp/models/implementations
    • test/library-tests/dataflow/taint-tests

2 files changed

+3
-1
lines changed

cpp/ql/lib/semmle/code/cpp/models/implementations/Strtok.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ private class Strtok extends ArrayFunction, AliasFunction, TaintFunction, SideEf
3232

3333
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
3434
input.isParameter(0) and output.isReturnValue()
35+
or
36+
input.isParameterDeref(0) and output.isReturnValueDeref()
3537
}
3638

3739
override predicate hasOnlySpecificReadSideEffects() { none() }

cpp/ql/test/library-tests/dataflow/taint-tests/taint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,6 @@ void test_strtok_indirect() {
718718
char *source = indirect_source();
719719
const char* delim = ",.-;:_";
720720
char* tokenized = strtok(source, delim);
721-
sink(*tokenized); // $ MISSING: ast,ir
721+
sink(*tokenized); // $ ir MISSING: ast
722722
sink(*delim);
723723
}

0 commit comments

Comments
 (0)