Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 5907173

Browse files
authored
taint-tracking: String() must return a string type
Make sure that the taint-tracking class for the `String()` method checks that the result type is a string.
1 parent bc778b5 commit 5907173

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import go
66

77
/** A `String()` method. */
88
class StringMethod extends TaintTracking::FunctionModel, Method {
9-
StringMethod() { getName() = "String" and getNumParameter() = 0 }
9+
StringMethod() {
10+
getName() = "String" and
11+
getNumParameter() = 0 and
12+
getResultType(0) = Builtin::string_().getType()
13+
}
1014

1115
override predicate hasTaintFlow(FunctionInput inp, FunctionOutput outp) {
1216
inp.isReceiver() and outp.isResult()

0 commit comments

Comments
 (0)