mirror of
https://github.com/securego/gosec.git
synced 2025-11-29 22:37:59 +02:00
Handle new function when getting the call info in case is overriden
Signed-off-by: Cosmin Cojocar <gcojocar@adobe.com>
This commit is contained in:
committed by
Cosmin Cojocar
parent
5b7867d125
commit
a11eb28e2f
@@ -183,7 +183,7 @@ func GetCallInfo(n ast.Node, ctx *Context) (string, string, error) {
|
||||
case *ast.CallExpr:
|
||||
switch call := expr.Fun.(type) {
|
||||
case *ast.Ident:
|
||||
if call.Name == "new" {
|
||||
if call.Name == "new" && len(expr.Args) > 0 {
|
||||
t := ctx.Info.TypeOf(expr.Args[0])
|
||||
if t != nil {
|
||||
return t.String(), fn.Sel.Name, nil
|
||||
|
||||
Reference in New Issue
Block a user