mirror of
https://github.com/securego/gosec.git
synced 2025-06-18 23:57:33 +02:00
Fix the errors rule whitelist to work on types methods
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
committed by
Cosmin Cojocar
parent
459e2d3e91
commit
3e069e7756
@ -16,8 +16,9 @@ package rules
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/securego/gosec"
|
||||
"go/ast"
|
||||
|
||||
"github.com/securego/gosec"
|
||||
)
|
||||
|
||||
type integerOverflowCheck struct {
|
||||
@ -47,7 +48,7 @@ func (i *integerOverflowCheck) Match(node ast.Node, ctx *gosec.Context) (*gosec.
|
||||
switch n := node.(type) {
|
||||
case *ast.AssignStmt:
|
||||
for _, expr := range n.Rhs {
|
||||
if callExpr, ok := expr.(*ast.CallExpr); ok && i.calls.ContainsCallExpr(callExpr, ctx, false) != nil {
|
||||
if callExpr, ok := expr.(*ast.CallExpr); ok && i.calls.ContainsPkgCallExpr(callExpr, ctx, false) != nil {
|
||||
if idt, ok := n.Lhs[0].(*ast.Ident); ok && idt.Name != "_" {
|
||||
// Example:
|
||||
// v, _ := strconv.Atoi("1111")
|
||||
|
Reference in New Issue
Block a user