Skip to content

Commit

Permalink
Fix a panic in suproc rule when the declaration of the variable is no…
Browse files Browse the repository at this point in the history
…t available in the AST (#728)
  • Loading branch information
ccojocar committed Nov 16, 2021
1 parent ff17c30 commit e57efa8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rules/subproc.go
Expand Up @@ -55,6 +55,10 @@ func (r *subprocess) Match(n ast.Node, c *gosec.Context) (*gosec.Issue, error) {
// .. indeed it is a variable then processing is different than a normal
// field assignment
if variable {
// skip the check when the declaration is not available
if ident.Obj == nil {
continue
}
switch ident.Obj.Decl.(type) {
case *ast.AssignStmt:
_, assignment := ident.Obj.Decl.(*ast.AssignStmt)
Expand Down

0 comments on commit e57efa8

Please sign in to comment.