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

Skip to content

Commit 9e38e8d

Browse files
committed
Restore model of builtin copy function.
This is another with no real signature type.
1 parent 0249669 commit 9e38e8d

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

go/ql/lib/semmle/go/frameworks/Stdlib.qll

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ import semmle.go.frameworks.stdlib.TextTabwriter
4444
import semmle.go.frameworks.stdlib.TextTemplate
4545
import semmle.go.frameworks.stdlib.Unsafe
4646

47-
// This is modelled using TaintTracking::FunctionModel because it doesn't have a real type signature,
48-
// and therefore currently has an InvalidType, not a SignatureType, which breaks Models as Data.
47+
// These are modelled using TaintTracking::FunctionModel because they doesn't have real type signatures,
48+
// and therefore currently have an InvalidType, not a SignatureType, which breaks Models as Data.
4949
/**
5050
* A model of the built-in `append` function, which propagates taint from its arguments to its
5151
* result.
@@ -58,6 +58,18 @@ private class AppendFunction extends TaintTracking::FunctionModel {
5858
}
5959
}
6060

61+
/**
62+
* A model of the built-in `copy` function, which propagates taint from its second argument
63+
* to its first.
64+
*/
65+
private class CopyFunction extends TaintTracking::FunctionModel {
66+
CopyFunction() { this = Builtin::copy() }
67+
68+
override predicate hasTaintFlow(FunctionInput inp, FunctionOutput outp) {
69+
inp.isParameter(1) and outp.isParameter(0)
70+
}
71+
}
72+
6173
/** Provides a class for modeling functions which convert strings into integers. */
6274
module IntegerParser {
6375
/**

0 commit comments

Comments
 (0)