mirror of
https://github.com/securego/gosec.git
synced 2025-06-16 23:47:51 +02:00
Fix wrong location for G109 (#829)
Before this commit, G109 will report on `strconv.Atoi`. After this, it will report on the convertion like`int32(a)`.
This commit is contained in:
@ -61,7 +61,7 @@ func (i *integerOverflowCheck) Match(node ast.Node, ctx *gosec.Context) (*gosec.
|
||||
if fun, ok := n.Fun.(*ast.Ident); ok {
|
||||
if fun.Name == "int32" || fun.Name == "int16" {
|
||||
if idt, ok := n.Args[0].(*ast.Ident); ok {
|
||||
if n, ok := atoiVarObj[idt.Obj]; ok {
|
||||
if _, ok := atoiVarObj[idt.Obj]; ok {
|
||||
// Detect int32(v) and int16(v)
|
||||
return gosec.NewIssue(ctx, n, i.ID(), i.What, i.Severity, i.Confidence), nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user