mirror of
https://github.com/securego/gosec.git
synced 2025-03-17 20:57:54 +02:00
Fix a panic in suproc rule when the declaration of the variable is not available in the AST (#728)
This commit is contained in:
parent
ff17c30a97
commit
e57efa8482
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user