From b6f85d50daaade42d25ab4da0b5e9516b909c2ac Mon Sep 17 00:00:00 2001 From: Grant Murphy Date: Fri, 5 Jan 2018 22:19:08 +1000 Subject: [PATCH] Fix nil pointer dereference in complit types --- rules/tls.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/tls.go b/rules/tls.go index c0971b2..83c1c12 100644 --- a/rules/tls.go +++ b/rules/tls.go @@ -106,7 +106,7 @@ func (t *insecureConfigTLS) processTLSConfVal(n *ast.KeyValueExpr, c *gas.Contex } func (t *insecureConfigTLS) Match(n ast.Node, c *gas.Context) (*gas.Issue, error) { - if complit, ok := n.(*ast.CompositeLit); ok && c.Info.TypeOf(complit.Type).String() == t.requiredType { + if complit, ok := n.(*ast.CompositeLit); ok && complit.Type != nil && c.Info.TypeOf(complit.Type).String() == t.requiredType { for _, elt := range complit.Elts { if kve, ok := elt.(*ast.KeyValueExpr); ok { issue := t.processTLSConfVal(kve, c)