Skip to content

Commit 9a2bec1

Browse files
authored
Merge pull request #149 from GoASTScanner/experimental
Fix nil pointer dereference in complit types
2 parents 3520a5a + b6f85d5 commit 9a2bec1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rules/tls.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func (t *insecureConfigTLS) processTLSConfVal(n *ast.KeyValueExpr, c *gas.Contex
106106
}
107107

108108
func (t *insecureConfigTLS) Match(n ast.Node, c *gas.Context) (*gas.Issue, error) {
109-
if complit, ok := n.(*ast.CompositeLit); ok && c.Info.TypeOf(complit.Type).String() == t.requiredType {
109+
if complit, ok := n.(*ast.CompositeLit); ok && complit.Type != nil && c.Info.TypeOf(complit.Type).String() == t.requiredType {
110110
for _, elt := range complit.Elts {
111111
if kve, ok := elt.(*ast.KeyValueExpr); ok {
112112
issue := t.processTLSConfVal(kve, c)

0 commit comments

Comments
 (0)