1
0
mirror of https://github.com/securego/gosec.git synced 2025-07-07 00:35:35 +02:00

Extend the bind rule to handle the case when the net.Listen address in provided from a const

This commit is contained in:
Cosmin Cojocar
2018-12-02 16:28:51 +01:00
committed by Cosmin Cojocar
parent 9b32fcac16
commit 24e3094d2a
3 changed files with 48 additions and 19 deletions

View File

@ -134,6 +134,21 @@ func main() {
log.Fatal(err)
}
defer l.Close()
}`}, 1},
{[]string{`
package main
import (
"log"
"net"
)
const addr = "0.0.0.0:2000"
func main() {
l, err := net.Listen("tcp", addr)
if err != nil {
log.Fatal(err)
}
defer l.Close()
}`}, 1},
}
// SampleCodeG103 find instances of unsafe blocks for auditing purposes