Skip to content

Commit

Permalink
Merge pull request #74 from Icinga/objectpacker-gosec-nolint
Browse files Browse the repository at this point in the history
objectpacker: Assure gosec that in.Len() to uint64 cannot overflow
  • Loading branch information
lippserd authored Oct 7, 2024
2 parents afba056 + ef4abc3 commit a9fcd1b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions objectpacker/objectpacker.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func packValue(in reflect.Value, out io.Writer) error {
}

l := in.Len()
// #nosec G115 -- in.Len() is a non-negative number, thus cannot overflow for conversion to uint64
if err := binary.Write(out, binary.BigEndian, uint64(l)); err != nil {
return err
}
Expand Down Expand Up @@ -118,6 +119,7 @@ func packValue(in reflect.Value, out io.Writer) error {
}

l := in.Len()
// #nosec G115 -- in.Len() is a non-negative number, thus cannot overflow for conversion to uint64
if err := binary.Write(out, binary.BigEndian, uint64(l)); err != nil {
return err
}
Expand Down

0 comments on commit a9fcd1b

Please sign in to comment.