Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/guestagent/guestagent_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func (a *agent) LocalPorts(_ context.Context) ([]*api.IPPort, error) {
res = append(res,
&api.IPPort{
Ip: ipt.IP.String(),
Port: int32(ipt.Port),
Port: int32(ipt.Port), // The port value is already ensured to be within int32 bounds in iptables.go
Protocol: "tcp",
})
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/guestagent/iptables/iptables.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ func parsePortsFromRules(rules []string) ([]Entry, error) {
for _, rule := range rules {
if found := findPortRegex.FindStringSubmatch(rule); found != nil {
if len(found) == 4 {
port, err := strconv.Atoi(found[3])
port64, err := strconv.ParseInt(found[3], 10, 32)
if err != nil {
return nil, err
}
port := int(port64)

istcp := found[2] == "tcp"

Expand Down
Loading