Exploit databaseDownload repository ZIP
GH-f0a9bb99064fc5c640a8aca726a5dee3
actions-marketplace-validations/securego_gosec
Sources for CVE-2022-23772
3 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files69
actions-marketplace-validations/securego_gosecRevision a3d5223361a5
- ↑..Parent directory
- build_samples.go
- cgo_samples.go
- deps_test.go
- g101_samples.go
- g102_samples.go
- g103_samples.go
- g104_samples.go
- g106_samples.go
- g107_samples.go
- g108_samples.go
- g109_samples.go
- g110_samples.go
- g111_samples.go
- g112_samples.go
- g113_samples.go
- g114_samples.go
- g115_samples.go
- g116_samples.go
- g117_samples.go
- g118_samples.go
- g119_samples.go
- g120_samples.go
- g121_samples.go
- g122_samples.go
- g123_samples.go
- g124_samples.go
- g125_samples.go
- g201_samples.go
- g202_samples.go
- g203_samples.go
- g204_samples.go
- g301_samples.go
- g302_samples.go
- g303_samples.go
- g304_samples.go
- g305_samples.go
- g306_samples.go
- g307_samples.go
- g401_samples.go
- g402_samples.go
- g403_samples.go
- g404_samples.go
- g405_samples.go
- g406_samples.go
- g407_samples.go
- g408_samples.go
- g501_samples.go
- g502_samples.go
- g503_samples.go
- g504_samples.go
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
testutils/g601_samples.go
Go · 2,863 bytespackage testutils
import "github.com/securego/gosec/v2"
// SampleCodeG601 - Implicit aliasing over range statement
var SampleCodeG601 = []CodeSample{
{[]string{`
package main
import "fmt"
var vector []*string
func appendVector(s *string) {
vector = append(vector, s)
}
func printVector() {
for _, item := range vector {
fmt.Printf("%s", *item)
}
fmt.Println()
}
func foo() (int, **string, *string) {
for _, item := range vector {
return 0, &item, item
}
return 0, nil, nil
}
func main() {
for _, item := range []string{"A", "B", "C"} {
appendVector(&item)
}
printVector()
zero, c_star, c := foo()
fmt.Printf("%d %v %s", zero, c_star, c)
}
`}, 1, gosec.NewConfig()},
{[]string{`
// see: github.com/securego/gosec/issues/475
package main
import (
"fmt"
)
func main() {
sampleMap := map[string]string{}
sampleString := "A string"
for sampleString, _ = range sampleMap {
fmt.Println(sampleString)
}
}
`}, 0, gosec.NewConfig()},
{[]string{`
package main
import (
"fmt"
)
type sampleStruct struct {
name string
}
func main() {
samples := []sampleStruct{
{name: "a"},
{name: "b"},
}
for _, sample := range samples {
fmt.Println(sample.name)
}
}
`}, 0, gosec.NewConfig()},
{[]string{`
package main
import (
"fmt"
)
type sampleStruct struct {
name string
}
func main() {
samples := []*sampleStruct{
{name: "a"},
{name: "b"},
}
for _, sample := range samples {
fmt.Println(&sample)
}
}
`}, 1, gosec.NewConfig()},
{[]string{`
package main
import (
"fmt"
)
type sampleStruct struct {
name string
}
func main() {
samples := []*sampleStruct{
{name: "a"},
{name: "b"},
}
for _, sample := range samples {
fmt.Println(&sample.name)
}
}
`}, 0, gosec.NewConfig()},
{[]string{`
package main
import (
"fmt"
)
type sampleStruct struct {
name string
}
func main() {
samples := []sampleStruct{
{name: "a"},
{name: "b"},
}
for _, sample := range samples {
fmt.Println(&sample.name)
}
}
`}, 1, gosec.NewConfig()},
{[]string{`
package main
import (
"fmt"
)
type subStruct struct {
name string
}
type sampleStruct struct {
sub subStruct
}
func main() {
samples := []sampleStruct{
{sub: subStruct{name: "a"}},
{sub: subStruct{name: "b"}},
}
for _, sample := range samples {
fmt.Println(&sample.sub.name)
}
}
`}, 1, gosec.NewConfig()},
{[]string{`
package main
import (
"fmt"
)
type subStruct struct {
name string
}
type sampleStruct struct {
sub subStruct
}
func main() {
samples := []*sampleStruct{
{sub: subStruct{name: "a"}},
{sub: subStruct{name: "b"}},
}
for _, sample := range samples {
fmt.Println(&sample.sub.name)
}
}
`}, 0, gosec.NewConfig()},
{[]string{`
package main
import (
"fmt"
)
func main() {
one, two := 1, 2
samples := []*int{&one, &two}
for _, sample := range samples {
fmt.Println(&sample)
}
}
`}, 1, gosec.NewConfig()},
}