mirror of
https://github.com/securego/gosec.git
synced 2024-12-26 20:45:53 +00:00
commit
b8e78c644b
2 changed files with 7 additions and 1 deletions
|
@ -35,7 +35,7 @@ func (r *UsingUnsafe) Match(n ast.Node, c *gas.Context) (gi *gas.Issue, err erro
|
||||||
|
|
||||||
func NewUsingUnsafe(conf map[string]interface{}) (r gas.Rule, n ast.Node) {
|
func NewUsingUnsafe(conf map[string]interface{}) (r gas.Rule, n ast.Node) {
|
||||||
r = &UsingUnsafe{
|
r = &UsingUnsafe{
|
||||||
pattern: regexp.MustCompile(`unsafe.*`),
|
pattern: regexp.MustCompile(`unsafe\..*`),
|
||||||
MetaData: gas.MetaData{
|
MetaData: gas.MetaData{
|
||||||
What: "Use of unsafe calls should be audited",
|
What: "Use of unsafe calls should be audited",
|
||||||
Severity: gas.Low,
|
Severity: gas.Low,
|
||||||
|
|
|
@ -33,7 +33,13 @@ func TestUnsafe(t *testing.T) {
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type Fake struct{}
|
||||||
|
|
||||||
|
func (Fake) Good() {}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
unsafeM := Fake{}
|
||||||
|
unsafeM.Good()
|
||||||
intArray := [...]int{1, 2}
|
intArray := [...]int{1, 2}
|
||||||
fmt.Printf("\nintArray: %v\n", intArray)
|
fmt.Printf("\nintArray: %v\n", intArray)
|
||||||
intPtr := &intArray[0]
|
intPtr := &intArray[0]
|
||||||
|
|
Loading…
Reference in a new issue