[go: nahoru, domu]

Skip to content

Commit

Permalink
Parse the routingTableID correctly [rtnetlink.h](https://github.com/t…
Browse files Browse the repository at this point in the history
  • Loading branch information
Cellebyte committed Jun 25, 2024
1 parent 9abce4a commit 97d8b08
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/kubevip/config_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package kubevip

import (
"encoding/json"
"fmt"
"math"
"math/bits"
"os"
"strconv"

Expand Down Expand Up @@ -316,10 +319,13 @@ func ParseEnvironment(c *Config) error {
// Routing Table ID
env = os.Getenv(vipRoutingTableID)
if env != "" {
i, err := strconv.ParseInt(env, 10, 32)
i, err := strconv.ParseInt(env, 10, 64)
if err != nil {
return err
}
if i > math.MaxInt32 && math.MaxInt < math.MaxInt64 {
return fmt.Errorf("system does not support int64 natively only [int%d]", bits.OnesCount(math.MaxInt)+1)
}
c.RoutingTableID = int(i)

Check failure

Code scanning / CodeQL

Incorrect conversion between integer types High

Incorrect conversion of a signed 64-bit integer from
strconv.ParseInt
to a lower bit size type int without an upper bound check.
}

Expand Down

0 comments on commit 97d8b08

Please sign in to comment.