Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 75aa1e8

Browse files
committed
C++: Respond to review comments.
1 parent 7affbfc commit 75aa1e8

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

cpp/ql/src/semmle/code/cpp/models/implementations/Strset.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ private class StrsetFunction extends ArrayFunction, DataFlowFunction, AliasFunct
2222
])
2323
}
2424

25+
override predicate hasArrayWithNullTerminator(int bufParam) { bufParam = 0 }
26+
27+
override predicate hasArrayInput(int bufParam) { bufParam = 0 }
28+
29+
override predicate hasArrayOutput(int bufParam) { bufParam = 0 }
30+
2531
override predicate hasDataFlow(FunctionInput input, FunctionOutput output) {
2632
// flow from the character that overrides the string
2733
input.isParameter(1) and
@@ -49,4 +55,8 @@ private class StrsetFunction extends ArrayFunction, DataFlowFunction, AliasFunct
4955
override predicate hasSpecificWriteSideEffect(ParameterIndex i, boolean buffer, boolean mustWrite) {
5056
i = 0 and buffer = true and mustWrite = true
5157
}
58+
59+
override predicate hasSpecificReadSideEffect(ParameterIndex i, boolean buffer) {
60+
i = 0 and buffer = true
61+
}
5262
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ private class Strtok extends ArrayFunction, AliasFunction, TaintFunction, SideEf
3535
input.isParameter(0) and output.isReturnValue()
3636
}
3737

38-
override predicate hasOnlySpecificReadSideEffects() { any() }
38+
override predicate hasOnlySpecificReadSideEffects() { none() }
3939

40-
override predicate hasOnlySpecificWriteSideEffects() { any() }
40+
override predicate hasOnlySpecificWriteSideEffects() { none() }
4141

4242
override predicate hasSpecificWriteSideEffect(ParameterIndex i, boolean buffer, boolean mustWrite) {
4343
i = 0 and buffer = true and mustWrite = false

0 commit comments

Comments
 (0)