Skip to content

Commit

Permalink
Fix from code scan
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Noël Moyne <[email protected]>
  • Loading branch information
jnmoyne committed Jul 16, 2024
1 parent bdc11cd commit 48c1644
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cli/bench_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"fmt"
"github.com/nats-io/nats.go/jetstream"
"math"
"math/rand"
"os"
"strconv"
Expand Down Expand Up @@ -292,11 +293,11 @@ func (c *benchCmd) processActionArgs() error {
// for pubs/request/and put only
if c.msgSizeString != "" {
msgSize, err := parseStringAsBytes(c.msgSizeString)
if err != nil || msgSize <= 0 {
if err != nil || msgSize <= 0 || msgSize > math.MaxInt {
return fmt.Errorf("can not parse or invalid the value specified for the message size: %s", c.msgSizeString)
} else {
c.msgSize = int(msgSize)
}

c.msgSize = int(msgSize)
}

if opts().Config == nil {
Expand Down

0 comments on commit 48c1644

Please sign in to comment.