@@ -6,24 +6,20 @@ import go
66
77/** Provides models of commonly used functions in the `fmt` package. */
88module Fmt {
9- /** The `Sprint` function or one of its variants. */
10- class Sprinter extends TaintTracking:: FunctionModel {
11- Sprinter ( ) {
12- // signature: func Sprint(a ...interface{}) string
13- this .hasQualifiedName ( "fmt" , "Sprint" )
14- or
15- // signature: func Sprintf(format string, a ...interface{}) string
16- this .hasQualifiedName ( "fmt" , "Sprintf" )
17- or
18- // signature: func Sprintln(a ...interface{}) string
19- this .hasQualifiedName ( "fmt" , "Sprintln" )
20- }
9+ /** The `Sprint` or `Append` functions or one of their variants. */
10+ class AppenderOrSprinter extends TaintTracking:: FunctionModel {
11+ AppenderOrSprinter ( ) { this .hasQualifiedName ( "fmt" , [ "Append" , "Sprint" ] + [ "" , "f" , "ln" ] ) }
2112
2213 override predicate hasTaintFlow ( FunctionInput inp , FunctionOutput outp ) {
2314 inp .isParameter ( _) and outp .isResult ( )
2415 }
2516 }
2617
18+ /** The `Sprint` function or one of its variants. */
19+ class Sprinter extends AppenderOrSprinter {
20+ Sprinter ( ) { this .getName ( ) .matches ( "Sprint%" ) }
21+ }
22+
2723 /** The `Print` function or one of its variants. */
2824 class Printer extends Function {
2925 Printer ( ) { this .hasQualifiedName ( "fmt" , [ "Print" , "Printf" , "Println" ] ) }
0 commit comments