Skip to content

Commit d259e8e

Browse files
committed
C++: Correct StrCpy.hasTaintFlow.
1 parent c3d275d commit d259e8e

File tree

1 file changed

+4
-1
lines changed
  • cpp/ql/src/semmle/code/cpp/models/implementations

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@ class StrcpyFunction extends ArrayFunction, DataFlowFunction, TaintFunction, Sid
9393
}
9494

9595
override predicate hasDataFlow(FunctionInput input, FunctionOutput output) {
96+
not exists(getParamSize()) and
9697
input.isParameterDeref(getParamSrc()) and
9798
output.isParameterDeref(getParamDest())
9899
or
100+
not exists(getParamSize()) and
99101
input.isParameterDeref(getParamSrc()) and
100102
output.isReturnValueDeref()
101103
or
@@ -106,7 +108,8 @@ class StrcpyFunction extends ArrayFunction, DataFlowFunction, TaintFunction, Sid
106108
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
107109
// these may do only a partial copy of the input buffer to the output
108110
// buffer
109-
input.isParameter(getParamSize()) and
111+
exists(getParamSize()) and
112+
input.isParameter(getParamSrc()) and
110113
(
111114
output.isParameterDeref(getParamDest()) or
112115
output.isReturnValueDeref()

0 commit comments

Comments
 (0)